#install.packages(c("rtf"), repos = "http://cran.r-project.org")
library(rtf)
#install.packages("parallel")
library(parallel)
#install.packages("data.table")
library(data.table)
#install.packages("ggplot2")
library(ggplot2)
#install.packages("ggpubr")
#devtools::install_github("kassambara/ggpubr")
library(ggpubr)
library(dplyr)
#install.packages("ARTool")
#install.packages("lubridate")
#install.packages("kableExtra")
#install.packages("caret")
library(ARTool)
library(lubridate)
library(kableExtra)
library(caret)
#install.packages("hrbrthemes")
library(hrbrthemes)
#install.packages("modeest")
library(modeest)
# Robust Analysis
#install.packages("WRS2")
library(WRS2)
source("Rallfun-v37.txt");
PathDesign="Design_Sleep3/"
ColPer<-c("cyan3","blue","red", "magenta2");
LabX<-c("YC","YSD","OC","OSD")
SEM_MM<-function(x) sem=sd(x,na.rm = T)/sqrt(length(x))
Mean_MM<-function(x) mean=mean(x,na.rm = T)
Mean_MMtr<-function(x) mean=mean(x,na.rm = T,trim = 0.2)
tmmm<-function(x) tmean(na.omit(x))
bbwtrimbt_vMM<-function(J, K, L, x, tr = 0.2, JKL = J * K*L, con = 0,
alpha = 0.05, grp =c(1:JKL), nboot = 599, SEED = TRUE, ...)
{
#
# Bootstrap-t for omniubs tests associated with
# all main effects and interactions
# for a between-by-between-within design.
#
# The R variable x is assumed to contain the raw
# data stored in list mode or in a matrix.
# If in list mode, x[[1]] contains the data
# for the first level for all three factors: levels 1,1,1.
# x[[2]] is assumed to contain the data for level 1 of the
# first factor and second factor and level 2 of the third: level 1,1,2
# x[[K]] is the data for level 1,1,L
# x[[L+1]] is the data for level 1,2,1, x[[2K]] is level 1,2,2, etc.
#
# If the data are in a matrix, column 1 is assumed to
# correspond to x[[1]], column 2 to x[[2]], etc.
#
# When in list mode x is assumed to have length JK, the total number
# groups being tested, but a subset of the data can be analyzed
# using grp
#
require(parallel)
if(is.data.frame(x))data=as.matrix(x)
if(is.matrix(x)) {
y <- list()
for(j in 1:ncol(x)) y[[j]] <- x[, j]
x <- y
}
# conM = con3way(J,K,L)
p <- J*K*L
if(p>length(x))stop("JKL is less than the Number of groups")
JK=J*K
v <- matrix(0, p, p)
data <- list()
xx=list()
for(j in 1:length(x)) {
data[[j]] <- x[[grp[j]]]
xx[[j]]=x[[grp[j]]] # save input data
# Now have the groups in proper order.
data[[j]] = data[[j]] - mean(data[[j]], tr = tr)
}
#ilow=0-L
#iup=0
#for(j in 1:JK){
#ilow <- ilow + L
# iup = iup + L
#sel <- c(ilow:iup)
#xx[sel]=listm(elimna(matl(xx[sel])))
# v[sel, sel] <- covmtrim(xx[sel], tr)
# }
test.stat=bbwtrim(J,K,L,xx,tr=tr)
x <- data # Centered data
# jp <- 1 - K
# kv <- 0
if(SEED)
set.seed(2)
# set seed of random number generator so that
# results can be duplicated.
testA = NA
testB = NA
testC=NA
testAB = NA
testAC = NA
testBC = NA
testABC = NA
bsam = list()
bdat = list()
aboot=NA
bboot=NA
cboot=NA
abboot=NA
acboot=NA
bcboot=NA
abcboot=NA
nvec=NA
Res<-lapply(1:JK, function(j)
{
nvec[j] = length(x[[j]])
mclapply (1:nboot, function(ib) {
ilow <- 1 - L; iup = 0
bsam= unlist(lapply(1:JK, function (j){
ilow <- ilow + L; iup = iup + L;nv=length(x[[ilow]])
bdat[[j]] = sample(nv, size = nv, replace =TRUE)
lapply (ilow:iup, function(k) x[[k]][sample(nv, size = nv, replace =TRUE)])
}),recursive = F)
temp=bbwtrim(J,K,L,bsam,tr=tr)
with(temp, c(Qa,Qb,Qc,Qab,Qac,Qbc,Qabc))
},
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
})
Res2<-as.data.table(unlist(Res, recursive = F))
pbA=NA
pbB=NA
pbC=NA
pbAB=NA
pbAC=NA
pbBC=NA
pbABC=NA
pbA=mean(test.stat$Qa[1,1]<Res2[1,])
pbB=mean(test.stat$Qb[1,1]<Res2[2,])
pbC=mean(test.stat$Qc[1,1]<Res2[3,])
pbAB=mean(test.stat$Qab[1,1]<Res2[3,])
pbAC=mean(test.stat$Qac[1,1]<Res2[3,])
pbBC=mean(test.stat$Qbc[1,1]<Res2[3,])
pbABC=mean(test.stat$Qabc[1,1]<Res2[3,])
list(p.value.A=pbA,p.value.B=pbB,p.value.C=pbC,p.value.AB=pbAB,
p.value.AC=pbAC,p.value.BC=pbBC,p.value.ABC=pbABC)
}
t2waybt_vMM<-function(J,K,x,tr=.2,grp=c(1:p),p=J*K,nboot=599,SEED=TRUE){
#
# Two-way ANOVA based on trimmed means and a bootstrap-t method
#
# The data are assumed to be stored as described in the function t2way
#
# The default number of bootstrap samples is nboot=599
#
require(parallel)
if(is.data.frame(x))x=as.matrix(x)
if(is.matrix(x))x<-listm(x)
if(!is.list(x))stop("Data must be stored in a matrix or in list mode.")
if(SEED)set.seed(2) # set seed of random number generator so that
# results can be duplicated.
# compute test statistics:
tests=t2way(J=J,K=K,x,tr=tr,grp=grp)
TA=NULL
TB=NULL
TAB=NULL
data=list()
xcen=list()
for(j in 1:length(x))xcen[[j]]<-x[[j]]-mean(x[[j]],tr)
print("Taking bootstrap samples. Please wait.")
Res<-mclapply (1:nboot, function(ib) {
data<-lapply(1:length(x), function(j) sample(xcen[[j]],size=length(x[[j]]),replace=TRUE))
bt=t2way(J,K,data,tr=tr,grp=grp)
with(bt, c(Qa,Qb,Qab))
},mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
Res2<-data.table(t(as.data.table(Res)))
pA<-sum(tests$Qa<=Res2$V1)/nboot
pB<-sum(tests$Qb<=Res2$V2)/nboot
pAB<-sum(tests$Qab<=Res2$V3)/nboot
list(A.p.value=pA,B.p.value=pB,AB.p.value=pAB)
}
ExtrSig<-function(DTPas,decim=4) {
require(data.table)
DTpp<-copy(DTPas)
Mx<-as.matrix(round(unlist(DTpp),decim))
ResP<-data.table(Eff=rownames(Mx),p=Mx);
ResP[,p.Sig:=""]
ResP[p.V1<.05,p.Sig:="* "]
return(as.data.table(ResP))
}
ExData.2<-function(nmF,Vars) {
# For Factorial Bw 2x2
require(data.table)
DatDTRes<-list()
DatDTFullp <- data.table(read.table(nmF, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
DatDTp<-DatDTFullp[,Vars,with=F]
LaVd<-length(DatDTp)
if (sum(grep("Mouse",names(DatDTp)))>0) {setnames(DatDTp, "Mouse", "Subject"); DatDTp$Subject<-factor(DatDTp$Subject)}
DatDTp$Age<-factor(DatDTp$Age);DatDTp$Age<-relevel(DatDTp$Age,"Young")
DatDTp$Sleep<-factor(DatDTp$Sleep);levels(DatDTp$Sleep) <- list("Control"="control", "SR"="restriction")
setkey(DatDTp,Age,Sleep)
ArP<-unlist(lapply(1:2, function (x) lapply(1:2, function(y) DatDTp[.(levels(DatDTp$Age)[x],levels(DatDTp$Sleep)[y]),LaVd,with=F][[1]])),recursive = F)
DatDTRes$DT<-copy(DatDTp)
DatDTRes$Arp<-ArP
DatDTRes
}
ExData.2b<-function(nmF,Vars,TypCel) {
# For Factorial Bw 2x2 & TypeCell
require(data.table)
DatDTRes<-list()
DatDTFullp <- data.table(read.table(nmF, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
setkey(DatDTFullp,Type)
DatDTFullp<-DatDTFullp[TypCel]
DatDTp<-DatDTFullp[,Vars,with=F]
LaVd<-length(DatDTp)
if (sum(grep("Mouse",names(DatDTp)))>0) {setnames(DatDTp, "Mouse", "Subject"); DatDTp$Subject<-factor(DatDTp$Subject)}
DatDTp$Age<-factor(DatDTp$Age);DatDTp$Age<-relevel(DatDTp$Age,"Young")
DatDTp$Sleep<-factor(DatDTp$Sleep);levels(DatDTp$Sleep) <- list("Control"="control", "SR"="restriction")
setkey(DatDTp,Age,Sleep)
ArP<-unlist(lapply(1:2, function (x) lapply(1:2, function(y) DatDTp[.(levels(DatDTp$Age)[x],levels(DatDTp$Sleep)[y]),LaVd,with=F][[1]])),recursive = F)
DatDTRes$DT<-copy(DatDTp)
DatDTRes$Arp<-ArP
DatDTRes
}
ExDataIS.2<-function(nmF,Vars,vIntP=0,lvlCh) {
# For trifactorial Mx {Design 2*2*(4*S)} or {Design 2*2*(5*S)}
require(data.table)
DatDTRes<-list()
DatDTFullp <- data.table(read.table(nmF, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
DatDTp<-DatDTFullp[,Vars,with=F]
LaVd<-length(DatDTp)
if (sum(grep("Mouse",names(DatDTp)))>0) setnames(DatDTp, "Mouse", "Subject")
if ("fullname" %in% names(DatDTp)) setnames(DatDTp, "fullname", "Subject")
DatDTp$Age<-factor(DatDTp$Age);DatDTp$Age<-relevel(DatDTp$Age,"Young")
DatDTp$Sleep<-factor(DatDTp$Sleep);levels(DatDTp$Sleep) <- list("Control"="control", "SR"="restriction")
DatDTp$Subject<-factor(DatDTp$Subject)
setkey(DatDTp,Age,Sleep)
NmIntra=names(DatDTp[,vIntP,with=F])
ExtendDTp<-reshape(DatDTp,direction = "long",varying = list(vIntP),idvar = "Subject",timevar=c("Moment"),times=NmIntra)
LaVd2<-length(ExtendDTp)
colnames(ExtendDTp)[LaVd2] <- "DepVar"
ExtendDTp$Moment<-factor(ExtendDTp$Moment)
levels(ExtendDTp$Moment) <-(lvlCh)
ExtendDTp$Age<-factor(ExtendDTp$Age);ExtendDTp$Age<-relevel(ExtendDTp$Age,"Young")
ExtendDTp$Sleep<-factor(ExtendDTp$Sleep);ExtendDTp$Sleep<-relevel(ExtendDTp$Sleep,"Control")
ExtendDTp$Inter<-interaction(ExtendDTp$Age,ExtendDTp$Sleep)
ExtendDTp$Inter<-factor( ExtendDTp$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
ArPp<-unlist(unlist(lapply(1:2, function (x) lapply(1:2, function(y) lapply(vIntP, function(z) na.omit(DatDTp[.(levels(DatDTp$Age)[x],levels(DatDTp$Sleep)[y]),z,with=F][[1]])))),recursive = F),recursive = F)
DatDTRes$DT<-copy(DatDTp)
DatDTRes$Arp<-copy(ArPp)
DatDTRes$ExtendDT<-copy(ExtendDTp)
DatDTRes
}
ExDataIS.2b<-function(nmF,Vars,vIntP=0,lvlCh) {
# For trifactorial Mx {Design 2*2*(4*S)} of Global Remap All Cells
require(data.table)
DatDTRes<-list()
DatDTFullp <- data.table(read.table(nmF, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
DatDTFullp[,Subject:=interaction(Mouse,Cell)]
DatDTp<-DatDTFullp[,Vars,with=F]
LaVd<-length(DatDTp)
if (sum(grep("Mouse",names(DatDTp)))>0) setnames(DatDTp, "Mouse", "Subject")
DatDTp$Age<-factor(DatDTp$Age);DatDTp$Age<-relevel(DatDTp$Age,"Young")
DatDTp$Sleep<-factor(DatDTp$Sleep);levels(DatDTp$Sleep) <- list("Control"="control", "SR"="restriction")
DatDTp$Subject<-factor(DatDTp$Subject)
setkey(DatDTp,Age,Sleep)
NmIntra=names(DatDTp[,vIntP,with=F])
ExtendDTp<-reshape(DatDTp,direction = "long",varying = list(vIntP),idvar = "Subject",timevar=c("Moment"),times=NmIntra)
LaVd2<-length(ExtendDTp)
colnames(ExtendDTp)[LaVd2] <- "DepVar"
ExtendDTp$Moment<-factor(ExtendDTp$Moment)
levels(ExtendDTp$Moment) <-(lvlCh)
ExtendDTp$Age<-factor(ExtendDTp$Age);ExtendDTp$Age<-relevel(ExtendDTp$Age,"Young")
ExtendDTp$Sleep<-factor(ExtendDTp$Sleep);ExtendDTp$Sleep<-relevel(ExtendDTp$Sleep,"Control")
ExtendDTp$Inter<-interaction(ExtendDTp$Age,ExtendDTp$Sleep)
ExtendDTp$Inter<-factor( ExtendDTp$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
ArPp<-unlist(unlist(lapply(1:2, function (x) lapply(1:2, function(y) lapply(vIntP, function(z) na.omit(DatDTp[.(levels(DatDTp$Age)[x],levels(DatDTp$Sleep)[y]),z,with=F][[1]])))),recursive = F),recursive = F)
DatDTRes$DT<-copy(DatDTp)
DatDTRes$Arp<-copy(ArPp)
DatDTRes$ExtendDT<-copy(ExtendDTp)
DatDTRes
}
ExDataIS.3<-function(nmF,Vars,vIntP=0,lvlCh,TypCel) {
# For trifactorial Mx {Design 2*2*(4*S)} of Global Remap Context Object or Unstable Cells
require(data.table)
DatDTRes<-list()
DatDTFullp <- data.table(read.table(nmF, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
if (!("fullname" %in% names(DatDTFullp))) {DatDTFullp[,Subject:=interaction(Mouse,Cell)]
}
if ("fullname" %in% names(DatDTFullp)) setnames(DatDTFullp, "fullname", "Subject")
setkey(DatDTFullp,Type)
DatDTFullp<-DatDTFullp[TypCel]
DatDTp<-DatDTFullp[,Vars,with=F]
LaVd<-length(DatDTp)
if (sum(grep("Mouse",names(DatDTp)))>0) setnames(DatDTp, "Mouse", "Subject")
DatDTp$Age<-factor(DatDTp$Age);DatDTp$Age<-relevel(DatDTp$Age,"Young")
DatDTp$Sleep<-factor(DatDTp$Sleep);levels(DatDTp$Sleep) <- list("Control"="control", "SR"="restriction")
DatDTp$Subject<-factor(DatDTp$Subject)
setkey(DatDTp,Age,Sleep)
NmIntra=names(DatDTp[,vIntP,with=F])
ExtendDTp<-reshape(DatDTp,direction = "long",varying = list(vIntP),idvar = "Subject",timevar=c("Moment"),times=NmIntra)
LaVd2<-length(ExtendDTp)
colnames(ExtendDTp)[LaVd2] <- "DepVar"
ExtendDTp$Moment<-factor(ExtendDTp$Moment)
levels(ExtendDTp$Moment) <-(lvlCh)
ExtendDTp$Age<-factor(ExtendDTp$Age);ExtendDTp$Age<-relevel(ExtendDTp$Age,"Young")
ExtendDTp$Sleep<-factor(ExtendDTp$Sleep);ExtendDTp$Sleep<-relevel(ExtendDTp$Sleep,"Control")
ExtendDTp$Inter<-interaction(ExtendDTp$Age,ExtendDTp$Sleep)
ExtendDTp$Inter<-factor( ExtendDTp$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
ArPp<-unlist(unlist(lapply(1:2, function (x) lapply(1:2, function(y) lapply(vIntP, function(z) na.omit(DatDTp[.(levels(DatDTp$Age)[x],levels(DatDTp$Sleep)[y]),z,with=F][[1]])))),recursive = F),recursive = F)
DatDTRes$DT<-copy(DatDTp)
DatDTRes$Arp<-copy(ArPp)
DatDTRes$ExtendDT<-copy(ExtendDTp)
DatDTRes
}
ExDataIS.3b<-function(nmF,Vars,vIntP=0,lvlCh,TypCel) {
# For bifactorial Mx {Design 2*(4*S)} of Global Remap Context Object or Unstable Cells
require(data.table)
DatDTRes<-list()
DatDTFullp <- data.table(read.table(nmF, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
if (!("fullname" %in% names(DatDTFullp))) {DatDTFullp[,Subject:=interaction(Mouse,Cell)]
}
if ("fullname" %in% names(DatDTFullp)) setnames(DatDTFullp, "fullname", "Subject")
DatDTFullp[,Subject:=interaction(Mouse,Cell)]
setkey(DatDTFullp,Type)
DatDTFullp<-DatDTFullp[TypCel]
DatDTp<-DatDTFullp[,Vars,with=F]
LaVd<-length(DatDTp)
#if (sum(grep("Mouse",names(DatDTp)))>0) setnames(DatDTp, "Mouse", "Subject")
#if ("fullname" %in% names(DatDTp)) setnames(DatDTp, "fullname", "Subject")
DatDTp$Age<-factor(DatDTp$Age);DatDTp$Age<-relevel(DatDTp$Age,"Young")
DatDTp$Sleep<-factor(DatDTp$Sleep);levels(DatDTp$Sleep) <- list("Control"="control", "SR"="restriction")
DatDTp$Subject<-factor(DatDTp$Subject)
setkey(DatDTp,Age,Sleep)
NmIntra=names(DatDTp[,vIntP,with=F])
ExtendDTp<-reshape(DatDTp,direction = "long",varying = list(vIntP),idvar = "Subject",timevar=c("Moment"),times=NmIntra)
LaVd2<-length(ExtendDTp)
colnames(ExtendDTp)[LaVd2] <- "DepVar"
ExtendDTp$Moment<-factor(ExtendDTp$Moment)
levels(ExtendDTp$Moment) <-(lvlCh)
ExtendDTp$Age<-factor(ExtendDTp$Age);ExtendDTp$Age<-relevel(ExtendDTp$Age,"Young")
ExtendDTp$Sleep<-factor(ExtendDTp$Sleep);ExtendDTp$Sleep<-relevel(ExtendDTp$Sleep,"Control")
ExtendDTp$Group<-interaction(ExtendDTp$Age,ExtendDTp$Sleep,sep = " ",drop = T)
#ExtendDTp$Inter<-factor( ExtendDTp$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
ArPp<-unlist(lapply(1:2, function (x) lapply(vIntP, function(z) na.omit(DatDTp[.(levels(DatDTp$Age)[x]),z,with=F][[1]]))),recursive = F)
NmIntra2<-c("Group","Subject",NmIntra)
DatDTp[,Group:=interaction(DatDTp$Age,DatDTp$Sleep,sep = " ",drop = T)]
DatDTRes$DT<-copy(DatDTp[,..NmIntra2])
DatDTRes$Arp<-copy(ArPp)
NmIntra3<-c("Group","Subject","Moment","DepVar")
DatDTRes$ExtendDT<-copy(ExtendDTp[,..NmIntra3])
DatDTRes
}
ExDataIS.3c<-function(nmF,Vars,vIntP=0,lvlCh) {
# For bifactorial Mx {Design 2*(4*S)}
require(data.table)
DatDTRes<-list()
DatDTFullp <- data.table(read.table(nmF, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
if (!("fullname" %in% names(DatDTFullp))) {DatDTFullp[,Subject:=interaction(Mouse,Cell)]
}
if ("fullname" %in% names(DatDTFullp)) setnames(DatDTFullp, "fullname", "Subject")
DatDTp<-DatDTFullp[,Vars,with=F]
LaVd<-length(DatDTp)
if (sum(grep("Mouse",names(DatDTp)))>0) setnames(DatDTp, "Mouse", "Subject")
DatDTp$Age<-factor(DatDTp$Age);DatDTp$Age<-relevel(DatDTp$Age,"Young")
DatDTp$Sleep<-factor(DatDTp$Sleep);levels(DatDTp$Sleep) <- list("Control"="control", "SR"="restriction")
DatDTp$Subject<-factor(DatDTp$Subject)
setkey(DatDTp,Age,Sleep)
NmIntra=names(DatDTp[,vIntP,with=F])
ExtendDTp<-reshape(DatDTp,direction = "long",varying = list(vIntP),idvar = "Subject",timevar=c("Moment"),times=NmIntra)
LaVd2<-length(ExtendDTp)
colnames(ExtendDTp)[LaVd2] <- "DepVar"
ExtendDTp$Moment<-factor(ExtendDTp$Moment)
levels(ExtendDTp$Moment) <-(lvlCh)
ExtendDTp$Age<-factor(ExtendDTp$Age);ExtendDTp$Age<-relevel(ExtendDTp$Age,"Young")
ExtendDTp$Sleep<-factor(ExtendDTp$Sleep);ExtendDTp$Sleep<-relevel(ExtendDTp$Sleep,"Control")
ExtendDTp$Group<-interaction(ExtendDTp$Age,ExtendDTp$Sleep,sep = " ",drop = T)
#ExtendDTp$Inter<-factor( ExtendDTp$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
ArPp<-unlist(lapply(1:2, function (x) lapply(vIntP, function(z) na.omit(DatDTp[.(levels(DatDTp$Age)[x]),z,with=F][[1]]))),recursive = F)
NmIntra2<-c("Group","Subject",NmIntra)
DatDTp[,Group:=interaction(DatDTp$Age,DatDTp$Sleep,sep = " ",drop = T)]
DatDTRes$DT<-copy(DatDTp[,..NmIntra2])
DatDTRes$Arp<-copy(ArPp)
NmIntra3<-c("Group","Subject","Moment","DepVar")
DatDTRes$ExtendDT<-copy(ExtendDTp[,..NmIntra3])
DatDTRes
}
Grph.1<-function(DatP,Dvp,LblsP=c("Preference for Displaced Object", "B","Object Preference During Test"),ylmP,hLin=F,GrpSel=c(2,4)){
# For on-way design
require(ggplot2)
ColPer2<-ColPer[GrpSel]
LabX2<-LabX[GrpSel]
g1<-ggplot2::ggplot(data=DatP, aes(x=Group, y=get(Dvp)))
gg1<-g1+ scale_fill_manual(values=ColPer2) +
geom_boxplot(colour=ColPer2, outlier.shape = NA,lwd=1) +
theme_classic2() + theme(legend.position="bottom", text = element_text(size=28),
axis.text.x = element_text(colour = "black"),axis.text.y = element_text(colour = "black")) +
labs(tag=LblsP[2],y=LblsP[3]) +
stat_summary(fun=tmmm, geom="point", shape=18,
size=4, color=ColPer2) + scale_x_discrete(name="",labels=LabX2) + ylim(ylmP)
if(hLin) gg1<-gg1+geom_hline(yintercept=0, linetype="dashed", color = "gray30")
gg1
}
Grph.2<-function(DatP,Dvp,LblsP=c("Preference for Displaced Object", "B","Object Preference During Test"),ylmP,hLin=F){
# For Factorial Design Bw 2*2
require(ggplot2)
g1<-ggplot2::ggplot(data=DatP, aes(x=Age:Sleep, y=get(Dvp)))
gg1<-g1+ scale_fill_manual(values=ColPer) +
geom_boxplot(colour=ColPer, outlier.shape = NA,lwd=1) +
theme_classic2() + theme(legend.position="bottom", text = element_text(size=28),
axis.text.x = element_text(colour = "black"),axis.text.y = element_text(colour = "black")) +
labs(tag=LblsP[2],y=LblsP[3]) +
stat_summary(fun=tmmm, geom="point", shape=18,
size=4, color=ColPer) + scale_x_discrete(name="",labels=LabX) + ylim(ylmP)
if(hLin) gg1<-gg1+geom_hline(yintercept=0, linetype="dashed", color = "gray30")
gg1
}
Grph.3<-function(DatP,Dvp,LblsP=c("Preference for Displaced Object", "B","Object Preference During Test"),ylmP,hLin=F,lvIp=4,wMain=F){
# For trifactorial Mx {Design 2*2*(4*S)} or {Design 2*2*(5*S)}
require(ggplot2)
ColPerI<-rep(ColPer,lvIp)
g1<-ggplot2::ggplot(data=DatP, aes(x=Moment, y=DepVar,fill=factor(Age:Sleep)))
df3<-DatP[,.(DepVar=tmean(na.omit(DepVar))),by=c("Age","Sleep","Moment")]
gg1<-g1+
geom_boxplot(colour=ColPerI, outlier.shape = NA,lwd=1) +
theme_classic2()+
theme(legend.position="None", text = element_text(size=28),
axis.text.x = element_text(colour = "black"),axis.text.y = element_text(colour = "black")) +
labs(tag=LblsP[2],y=LblsP[3],x="") +
scale_fill_manual(values=c(rep("white",4*lvIp)))+stat_summary(fun=tmmm, geom="point", shape=18,
size=4, color=ColPerI,position=position_dodge(width=.75)) + ylim(ylmP)
if(hLin) gg1<-gg1+geom_hline(yintercept=0, linetype="dashed", color = "gray30")
if(wMain) gg1<-gg1+stat_summary(fun=mean, geom="point", shape=13, size=8, color="black", fill="gray30") +
stat_summary(fun=mean, geom="point", shape=13, size=7, color="black", fill="gray30")
gg1
}
Grph.3.2Intra<-function(DatP,Dvp,LblsP=c("Preference for Displaced Object", "B","Object Preference During Test"),ylmP,hLin=F,lvIp=4,GrpSel=c(1,3),wMain=F){
# For trifactorial Mx {Design 2*2*(4*S)} or {Design 2*2*(5*S)}
require(ggplot2)
ColPerI<-rep(ColPer[GrpSel],lvIp)
g1<-ggplot2::ggplot(data=DatP, aes(x=Moment, y=DepVar,fill=factor(Group)))
df3<-DatP[,.(DepVar=tmean(na.omit(DepVar))),by=c("Group","Moment")]
gg1<-g1+
geom_boxplot(colour=ColPerI, outlier.shape = NA,lwd=1) +
theme_classic2()+
theme(legend.position="None", text = element_text(size=28),
axis.text.x = element_text(colour = "black"),axis.text.y = element_text(colour = "black")) +
labs(tag=LblsP[2],y=LblsP[3],x="") +
scale_fill_manual(values=c(rep("white",4*lvIp)))+stat_summary(fun=tmmm, geom="point", shape=18,
size=4, color=ColPerI,position=position_dodge(width=.75)) + ylim(ylmP)
if(hLin) gg1<-gg1+geom_hline(yintercept=0, linetype="dashed", color = "gray30")
if(wMain) gg1<-gg1+stat_summary(fun=mean, geom="point", shape=13, size=8, color="black", fill="gray30") +
stat_summary(fun=mean, geom="point", shape=13, size=7, color="black", fill="gray30")
gg1
}
Grph.3b<-function(DatP,Dvp,LblsP=c("Preference for Displaced Object", "B","Object Preference During Test"),ylmP,hLin=F,lvIp=4,GrpSel=c(2,4),wMain=F){
# For bifactorial Mx {Design 2*(4*S)} or {Design 2*(5*S)}
require(ggplot2)
ColPerI<-rep(ColPer[GrpSel],lvIp)
g1<-ggplot2::ggplot(data=DatP, aes(x=Moment, y=DepVar,fill=factor(Group)))
df3<-DatP[,.(DepVar=tmean(na.omit(DepVar))),by=c("Group","Moment")]
gg1<-g1+
geom_boxplot(colour=ColPerI, outlier.shape = NA,lwd=1) +
theme_classic2()+
theme(legend.position="None", text = element_text(size=28),
axis.text.x = element_text(colour = "black"),axis.text.y = element_text(colour = "black")) +
labs(tag=LblsP[2],y=LblsP[3],x="") +
scale_fill_manual(values=c(rep("white",4*lvIp)))+stat_summary(fun=tmmm, geom="point", shape=18,
size=4, color=ColPerI,position=position_dodge(width=.75)) + ylim(ylmP)
if(hLin) gg1<-gg1+geom_hline(yintercept=0, linetype="dashed", color = "gray30")
if(wMain) gg1<-gg1+stat_summary(fun=mean, geom="point", shape=13, size=8, color="black", fill="gray30") +
stat_summary(fun=mean, geom="point", shape=13, size=7, color="black", fill="gray30")
gg1
}
Grph.3c<-function(DatP,Dvp,LblsP=c("Preference for Displaced Object", "B","Object Preference During Test"),ylmP,hLin=F,lvIp=4,wMain=F){
# For trifactorial Bw {Design 2*2*2} for Implant, center on Implant
require(ggplot2)
ColPerI<-rep(ColPer[1:lvIp],4)
#ColPerI<-c("aquamarine","mediumaquamarine","cyan3","deepskyblue","darkblue","blue","lightsalmon","maroon","red","pink","purple","magenta2")
g1<-ggplot2::ggplot(data=DatP, aes(x=Age:Sleep, y=DepVar,fill=factor(Implant)))
df3<-DatP[,.(DepVar=tmean(na.omit(DepVar))),by=c("Age","Sleep","Implant")]
gg1<-g1+
geom_boxplot(colour=ColPerI, outlier.shape = NA,lwd=1) +
theme_classic2()+
theme(legend.position="None", text = element_text(size=28),
axis.text.x = element_text(colour = "black"),axis.text.y = element_text(colour = "black")) +
labs(tag=LblsP[2],y=LblsP[3],x="") + scale_x_discrete(labels=c("YC", "YSR", "OC","OSR")) +
scale_fill_manual(values=c(rep("white",4*lvIp)))+stat_summary(fun=tmmm, geom="point", shape=18,
size=4, color=ColPerI,position=position_dodge(width=.75)) + ylim(ylmP)
if(hLin) gg1<-gg1+geom_hline(yintercept=0, linetype="dashed", color = "gray30")
if(wMain) gg1<-gg1+stat_summary(fun=mean, geom="point", shape=13, size=8, color="black", fill="gray30") +
stat_summary(fun=mean, geom="point", shape=13, size=7, color="black", fill="gray30")
gg1
}
Grph.3d<-function(DatP,Dvp,LblsP=c("Preference for Displaced Object", "B","Object Preference During Test"),ylmP,hLin=F,lvIp=4,wMain=F){
# For trifactorial Bw {Design 2*2*2} For Implant, center on Interaction
require(ggplot2)
ColPerI<-rep(ColPer,lvIp)
g1<-ggplot2::ggplot(data=DatP, aes(x=Implant, y=DepVar,fill=factor(Age:Sleep)))
df3<-DatP[,.(DepVar=tmean(na.omit(DepVar))),by=c("Age","Sleep","Implant")]
gg1<-g1+
geom_boxplot(colour=ColPerI, outlier.shape = NA,lwd=1) +
theme_classic2()+
theme(legend.position="None", text = element_text(size=28),
axis.text.x = element_text(colour = "black"),axis.text.y = element_text(colour = "black")) +
labs(tag=LblsP[2],y=LblsP[3],x="") +
scale_fill_manual(values=c(rep("white",4*lvIp)))+stat_summary(fun=tmmm, geom="point", shape=18,
size=4, color=ColPerI,position=position_dodge(width=.75)) + ylim(ylmP)
if(hLin) gg1<-gg1+geom_hline(yintercept=0, linetype="dashed", color = "gray30")
if(wMain) gg1<-gg1+stat_summary(fun=mean, geom="point", shape=13, size=8, color="black", fill="gray30") +
stat_summary(fun=mean, geom="point", shape=13, size=7, color="black", fill="gray30")
gg1
}
Grph.3.Otros<-function(ExtendDTp,LblsP=c("Preference for Displaced Object", "B","Object Preference During Test")) {
df2<-ExtendDTp[,.(DepVar=Mean_MM(DepVar),sem=SEM_MM(DepVar)),by=c("Age", "Sleep","Moment")]
g1<-ggplot2::ggplot(data=ExtendDTp, aes(x=Moment, y=DepVar, fill=factor(Age:Sleep)))
g2<-ggplot2::ggplot(df2, aes(x=Moment, y=DepVar, fill=Age:Sleep))
ggg<-list()
ggg$BP<-g1+
geom_boxplot() +
scale_fill_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3"),name="Age * Sleep:",
breaks=c("Young:Control","Young:SR","Old:Control", "Old:SR"),
labels=c("Young Control", "Young SR","Old Control", "Old SR")) +
scale_colour_manual(values=c("gray30", "gray64", "dodgerblue3","blue3")) +
theme_classic2() + theme(legend.position="bottom") + labs(title = LblsP[1], tag=LblsP[2],y=LblsP[3])
ggg$Bars<-g2+
geom_bar(stat="identity", color="black",
position=position_dodge()) +
geom_errorbar(aes(ymin=DepVar-sem, ymax=DepVar+sem), width=.2,
position=position_dodge(.9)) +
scale_fill_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3"),name="Age * Sleep:",
breaks=c("Young:Control","Young:SR","Old:Control", "Old:SR"),
labels=c("Young Control", "Young SR","Old Control", "Old SR")) +
scale_colour_manual(values=c("gray30", "gray64", "dodgerblue3","blue3")) +
theme_classic2() + theme(legend.position="bottom") + labs(title = LblsP[1], tag=LblsP[2],y=LblsP[3])
# Marginals
#AB
df3<-ExtendDTp[,.(DepVar=Mean_MM(DepVar),sem=SEM_MM(DepVar)),by=c("Age", "Sleep")]
g3<-ggplot2::ggplot(df3, aes(x=Age, y=DepVar, fill=Sleep))
ggg$MargAB<-g3+
geom_bar(stat="identity", color="black",
position=position_dodge()) +
geom_errorbar(aes(ymin=DepVar-sem, ymax=DepVar+sem), width=.2,
position=position_dodge(.9)) +
scale_fill_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3"),name="Sleep:") +
scale_colour_manual(values=c("gray30", "gray64", "dodgerblue3","blue3")) +
theme_classic2() + theme(legend.position="bottom") + labs(title = LblsP[1], tag=LblsP[2],y=LblsP[3])
#AC
df4<-ExtendDTp[,.(DepVar=Mean_MM(DepVar),sem=SEM_MM(DepVar)),by=c("Age", "Moment")]
g4<-ggplot2::ggplot(df4, aes(x=Moment, y=DepVar, fill=Age))
ggg$MargAC<-g4+
geom_bar(stat="identity", color="black",
position=position_dodge()) +
geom_errorbar(aes(ymin=DepVar-sem, ymax=DepVar+sem), width=.2,
position=position_dodge(.9)) +
scale_fill_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3"),name="Age:") +
scale_colour_manual(values=c("gray30", "gray64", "dodgerblue3","blue3")) +
theme_classic2() + theme(legend.position="bottom") + labs(title = LblsP[1], tag=LblsP[2],y=LblsP[3])
#BC
df5<-ExtendDTp[,.(DepVar=Mean_MM(DepVar),sem=SEM_MM(DepVar)),by=c("Sleep", "Moment")]
g5<-ggplot2::ggplot(df5, aes(x=Moment, y=DepVar, fill=Sleep))
ggg$MargBC<-g5+
geom_bar(stat="identity", color="black",
position=position_dodge()) +
geom_errorbar(aes(ymin=DepVar-sem, ymax=DepVar+sem), width=.2,
position=position_dodge(.9)) +
scale_fill_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3"),name="Sleep:") +
scale_colour_manual(values=c("gray30", "gray64", "dodgerblue3","blue3")) +
theme_classic2() + theme(legend.position="bottom") + labs(title = LblsP[1], tag=LblsP[2],y=LblsP[3])
#C
df2.b<-ExtendDTp[,.(DepVar=Mean_MM(DepVar),sem=SEM_MM(DepVar)),by=c("Moment")]
g1.b<-ggplot2::ggplot(data=df2.b, aes(x=Moment, y=DepVar))
ggg$MargC<-g1.b+
geom_bar(stat="identity", color="black",
position=position_dodge()) +
geom_errorbar(aes(ymin=DepVar-sem, ymax=DepVar+sem), width=.2,
position=position_dodge(.9)) +
scale_fill_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3"),name="Group") +
scale_colour_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3")) +
theme_classic2() + theme(legend.position="bottom") + labs(title = LblsP[1], tag=LblsP[2],y=LblsP[3])
return(ggg)
}
Grph.3.Otrosb<-function(ExtendDTp,LblsP=c("Preference for Displaced Object", "B","Object Preference During Test")) {
df2<-ExtendDTp[,.(DepVar=Mean_MM(DepVar),sem=SEM_MM(DepVar)),by=c("Age", "Moment")]
g1<-ggplot2::ggplot(data=ExtendDTp, aes(x=Moment, y=DepVar, fill=factor(Age)))
g2<-ggplot2::ggplot(df2, aes(x=Moment, y=DepVar, fill=Age))
ggg<-list()
ggg$BP<-g1+
geom_boxplot() +
scale_fill_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3"),name="Age * Sleep:",
breaks=c("Young:Control","Young:SR","Old:Control", "Old:SR"),
labels=c("Young Control", "Young SR","Old Control", "Old SR")) +
scale_colour_manual(values=c("gray30", "gray64", "dodgerblue3","blue3")) +
theme_classic2() + theme(legend.position="bottom") + labs(title = LblsP[1], tag=LblsP[2],y=LblsP[3])
ggg$Bars<-g2+
geom_bar(stat="identity", color="black",
position=position_dodge()) +
geom_errorbar(aes(ymin=DepVar-sem, ymax=DepVar+sem), width=.2,
position=position_dodge(.9)) +
scale_fill_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3"),name="Age * Sleep:",
breaks=c("Young:Control","Young:SR","Old:Control", "Old:SR"),
labels=c("Young Control", "Young SR","Old Control", "Old SR")) +
scale_colour_manual(values=c("gray30", "gray64", "dodgerblue3","blue3")) +
theme_classic2() + theme(legend.position="bottom") + labs(title = LblsP[1], tag=LblsP[2],y=LblsP[3])
# Marginals
#AC
df4<-ExtendDTp[,.(DepVar=Mean_MM(DepVar),sem=SEM_MM(DepVar)),by=c("Age","Moment")]
g4<-ggplot2::ggplot(df4, aes(x=Moment, y=DepVar, fill=Age))
ggg$MargAC<-g4+
geom_bar(stat="identity", color="black",
position=position_dodge()) +
geom_errorbar(aes(ymin=DepVar-sem, ymax=DepVar+sem), width=.2,
position=position_dodge(.9)) +
scale_fill_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3"),name="Age:") +
scale_colour_manual(values=c("gray30", "gray64", "dodgerblue3","blue3")) +
theme_classic2() + theme(legend.position="bottom") + labs(title = LblsP[1], tag=LblsP[2],y=LblsP[3])
#C
df2.b<-ExtendDTp[,.(DepVar=Mean_MM(DepVar),sem=SEM_MM(DepVar)),by=c("Moment")]
g1.b<-ggplot2::ggplot(data=df2.b, aes(x=Moment, y=DepVar))
ggg$MargC<-g1.b+
geom_bar(stat="identity", color="black",
position=position_dodge()) +
geom_errorbar(aes(ymin=DepVar-sem, ymax=DepVar+sem), width=.2,
position=position_dodge(.9)) +
scale_fill_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3"),name="Age") +
scale_colour_manual(values=c("gray30", "gray64", "dodgerblue","dodgerblue3")) +
theme_classic2() + theme(legend.position="bottom") + labs(title = LblsP[1], tag=LblsP[2],y=LblsP[3])
return(ggg)
}
NCPosH<-function(nLA,nLB){
nL=nLA*nLB
NCPosH<-matrix(NA,(nL*(nL-1))/2,8)
NCombi<-matrix(NA,nL,2)
cnt<-0
for (i in (1:nLA)) for (j in (1:nLB)) NCombi[cnt<-cnt+1,1:2]<-c(i,j)
cnt<-0
for (i in (1:(nL-1))) for (j in ((i+1):(nL))) {
NCPosH[cnt<-cnt+1,1:2]<-c(i,j)
NCPosH[cnt,3:6]<-c(NCombi[i,],NCombi[j,])
NCPosH[cnt,7:8]<-0
if (NCPosH[cnt,3]==NCPosH[cnt,5]) NCPosH[cnt,7]<-1
if (NCPosH[cnt,4]==NCPosH[cnt,6]) NCPosH[cnt,8]<-1
}
return(NCPosH)
}
ContCAll<-function(A=1,B=1,C=2,Typ="Succ",CnSel=0) {
require(data.table)
conCRes<-matrix(0,nrow=A*B*C,ncol=1)
if (Typ=="Succ") {
conCRes<-matrix(0,nrow=A*B*C,ncol=C-1)
for (j in 0:(A*B-1)) for (i in 1:(C-1)) conCRes[c(C*j+i,C*j+i+1),i]<-c(1,-1);
}
if (Typ=="Succ.EfS") {
conCRes<-matrix(0,nrow=A*B*C,ncol=(C-1)*A*B)
cnt<-0
for (i in 1:(C-1)) for (j in 0:(A*B-1)) conCRes[c(C*j+i,C*j+i+1),cnt<-cnt+1]<-c(1,-1);
}
if (Typ=="Succ.AC") {
conCRes<-matrix(0,nrow=A*B*C,ncol=(C-1)*A)
cnt<-0
for (i in 1:(C-1)) {
for (k in 0:(A-1)) {
cnt<-cnt+1
for (j in 0:(B-1)) {
conCRes[c((k*C*B)+(C*j+i),(k*C*B)+(C*j+i+1)),cnt]<-c(1,-1);
}
}
}
}
if (Typ=="Succ.BC") {
conCRes<-matrix(0,nrow=A*B*C,ncol=(C-1)*B)
cnt<-0
for (i in 1:(C-1)) {
for (k in 0:(B-1)) {
cnt<-cnt+1
for (j in 0:(A-1)) {
conCRes[c((j*C*B)+(C*k+i),(j*C*B)+(C*k+i+1)),cnt]<-c(1,-1);
}
}
}
}
if (Typ=="PosHoc") {
nContr=(C*(C-1))/2
conCRes<-matrix(0,nrow=A*B*C,ncol=nContr)
for (k in 0:(A*B-1)) {
cont=0;
for (i in (1:(C-1))) {
for (j in ((i+1):(C))) {
cont=cont+1
conCRes[c(C*k+i,C*k+j),cont]=c(1,-1)
}
}
}
}
if (Typ=="PosHoc.AB"|Typ=="Desgl.AB") {
nCon<-A*B
nContr=(nCon*(nCon-1))/2
conCRes<-matrix(0,nrow=A*B*C,ncol=nContr)
cont=0;
for (i in (1:(nCon-1))) {
for (j in ((i+1):(nCon))) {
cont=cont+1
for (k in 0:(C-1)) {
conCRes[c(C*(i-1)+k+1,C*(j-1)+k+1),cont]=c(1,-1)
}
}
}
}
if (Typ=="Desgl.AB") {
aa<-data.frame(NCPosH(2,2))
Selaa<-c(which(aa[7]==1),which(aa[8]==1))
if (sum(CnSel)>0) Selaa<-c(Selaa, which(aa[1]==CnSel[1]&aa[2]==CnSel[2]))
conCRes=conCRes[,c(Selaa)]
}
if (Typ=="AenC") {
nContr=((A*(A-1))/2)*C
conCRes<-matrix(0,nrow=A*B*C,ncol=nContr)
#k=0;h=0
for (l in 0:(B-1)) {
cont=0;
for (i in (1:(A-1))) {
for (j in ((i+1):(A))){
for (k in 0:(C-1)) {
cont=cont+1
conCRes[c((C*B)*(i-1)+k+(l*C)+1,(C*B)*(j-1)+k+(l*C)+1),cont]=c(1,-1)
}
}
}
}
}
if (Typ=="BenC") {
nContr=((B*(B-1))/2)*C
conCRes<-matrix(0,nrow=A*B*C,ncol=nContr)
#k=0;h=0
for (l in 0:(A-1)) {
cont=0;
for (i in (1:(B-1))) {
for (j in ((i+1):(B))){
for (k in 0:(C-1)) {
cont=cont+1
conCRes[c(C*(i-1)+k+(l*C*A)+1,C*(j-1)+k+(l*C*A)+1),cont]=c(1,-1)
}
}
}
}
}
# A=2;B=2;C=4
if (Typ=="PosHoc.ABenC"|Typ=="Desgl.ABenC") {
nCon<-A*B
nContr=((nCon*(nCon-1))/2)*C
conCRes<-matrix(0,nrow=A*B*C,ncol=nContr)
cont=0;
for (k in 0:(C-1)) {
for (i in (1:(nCon-1))) {
for (j in ((i+1):(nCon))) {
cont=cont+1
conCRes[c(C*(i-1)+k+1,C*(j-1)+k+1),cont]=c(1,-1)
}
}
}
}
if (Typ=="Desgl.ABenC") {
aa<-NCPosH(2,2)
aaR <- data.table(aa[rep(seq_len(nrow(aa)), C),],V9=c(rep(c(1:C),each=nrow(aa))))
#aaR<-aaR[order(-V7,-V8)]
Res1<-lapply (1:C, function(x) c(
which(aaR[,7]==1 & aaR[,9]==x),
which(aaR[,8]==1 & aaR[,9]==x))
)
Selaa<-unlist(Res1)
aaR[Selaa,]
if (sum(CnSel)>0) Selaa<-c(Selaa, which(aa[1]==CnSel[1]&aa[2]==CnSel[2]))
conCRes=conCRes[,c(Selaa)]
}
if (Typ=="PosHoc.CenB") {
nContr=((C*(C-1))/2)
conCRes<-matrix(0,nrow=A*B*C,ncol=nContr)
#k=0;h=0;l=1
for (l in 0:(B-1)) {
cont=0;
for (i in (1:(C-1))) {
for (j in ((i+1):(C))){
cont=cont+1
conCRes[c(C*l+i,C*l+j),cont]=c(1,-1)
}
}
}
}
return(conCRes)
}
AOVSingle<-function(ArpP,Prc=2) {
# Robust AOV for 2-levels one-way design
# yuenv2, bdm
RestTestRob<-yuenv2(ArpP[[1]],ArpP[[2]])
RestTestRk1<-bdm(ArpP)
ResRoRes<-list()
ResRoRes$t<-with (RestTestRob, paste0("Diff = ",round(dif,Prc),", V(",round(df,Prc),") = ",
round(teststat,Prc),", Eff.Size = ",round(Effect.Size,Prc), ", p = ",round(p.value,4)))
ResRoRes$tRk1<-with (RestTestRk1, paste0("Diff = ",round(RestTestRob$dif,Prc),", Fw(",
round(nu1,Prc),",",round(nu2,Prc),") = ",round(F,Prc),", Eff.Size = ",
round(RestTestRob$Effect.Size,Prc), ", p = ",round(p.value,4)))
ResRoRes$t.2<- with (RestTestRob, as.data.table(cbind(round(dif,Prc), round(df,Prc),
round(teststat,Prc), round(Effect.Size,Prc), round(p.value,4))))
ResRoRes$tRk2<-with (RestTestRk1, as.data.table(cbind(
round(RestTestRob$dif,Prc), round(nu1,Prc),
round(nu2,Prc),round(F,Prc), round(RestTestRob$Effect.Size,Prc),
round(p.value,4))))
names(ResRoRes$t.2)<-c("Diff","DF","FW", "Ef.Size", "p")
names(ResRoRes$tRk2)<-c("Diff","DF1","DF2","Fw","Ef.Size", "p")
return(ResRoRes)
}
AOVBwF<-function(A=2,B=2,DatPas,nBMM=10000,Prc=2) {
# Omnibus design {2*2}
# t2way & rimul, t2waybt, t2waybt_vMM, bdm2way, ESmainMCP, esImcp
# ContAB2x2 vs ContAB2x2.Ext, lincon, yuen, t1waybt,
ExFin<-list()
ResRo<-list()
RsRb<-t2way(A,B,DatPas[[2]])
ResRo$w<- c(RsRb$A.p.value, RsRb$B.p.value, RsRb$AB.p.value)
ResRo$r<- rimul(A,B,DatPas[[2]],plotit = F)
ResRo$BT<-c(t2waybt(A,B,DatPas[[2]]))
APA.N1<-c(round(unlist(RsRb),4),round(unlist(ResRo$BT),4))
rr<-ExtrSig(ResRo$BT)
print(rr)
ResRo$BT_MM<-c(t2waybt_vMM(A,B,DatPas[[2]],nboot = nBMM))
ResRo$Rk1<- bdm2way(A,B,DatPas[[2]])
rr2=ExtrSig(ResRo$BT_MM)
print(rr2)
# Approximation to estimate Effect Size
TamA=round(mean(ESmainMCP(A,B,DatPas[[2]])$Factor.A[,3]),Prc)
TamB=round(mean(ESmainMCP(A,B,DatPas[[2]])$Factor.B[,3]),Prc)
TamInt=round(mean(esImcp(A,B,DatPas[[2]])$Effect.Sizes),Prc)
ExRsRbQ<-with(RsRb, round(c(Qa, Qb, Qab),Prc))
ExRsRbp<-with(RsRb, round(c(A.p.value, B.p.value,AB.p.value),4))
ExRsRb.QRMul<-copy(ExRsRbQ); ExRsRb.QRMul[3]<-round(ResRo$r$test[5],Prc);
ExRsRb.pRMul<-copy(ExRsRbp); ExRsRb.pRMul[3]<-round(ResRo$r$test[8],Prc);
ExRsRbF.Rk1<-with(ResRo$Rk1, round(c(A.F,B.F,AB.F),Prc));
ExRsRbp.Rk1<-with(ResRo$Rk1, round(c(p.valueA, p.valueB, p.valueAB),4));
ExFin$AOV<-data.table(ExRsRbQ,ExRsRbp,ExRsRb.QRMul, ExRsRb.pRMul, ExRsRbF.Rk1, ExRsRbp.Rk1, rr$p.V1,rr$p.Sig,rr2$p.V1,rr2$p.Sig)
names(ExFin$AOV)<-c("Q","p","Q.RMul","p.RMul", "F.Rk1", "p.Rk1", "pBoot","Sig","pBootMas","SigMas")
ExFin$AOV<-data.table(Names=c("Age","Sleep","Age*Sleep"),ExFin$AOV)
ExFin$AOV[,EffSize:=c(TamA,TamB,TamInt)]
#Interaction AB
# A on each B & B on each A
cnMM<-ContCAll(A=2,B=2,C=1,"Desgl.AB") #ContAB2x2
Contr.1<-lincon(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$psihat[,5],4)
# Approximation to estimate Effect Size
AExtrP<-c("test","p.value","Effect.Size")
EffA<-parallel::mclapply(1:A, function(x) WRS2::yuen(DepV~Sleep,data=DatPas[[1]][Age==levels(Age)[x]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
EffB<-parallel::mclapply(1:B, function(x) WRS2::yuen(DepV~Age,data=DatPas[[1]][Sleep==levels(Sleep)[x]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
EffAb<-parallel::mclapply(1:A, function(x) WRS2::t1waybt(DepV~Sleep,data=DatPas[[1]][Age==levels(Age)[x]],nboot = 900)[AExtrP],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
EffBb<-parallel::mclapply(1:B, function(x) WRS2::t1waybt(DepV~Age,data=DatPas[[1]][Sleep==levels(Sleep)[x]],nboot = 900)[AExtrP],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(c(unlist(EffA),unlist(EffB))),Prc)
ContrBooth1<-rbind(do.call(rbind, lapply(EffAb, as.data.table)),
do.call(rbind, lapply(EffBb, as.data.table)))
ContrBooth<-round(ContrBooth1,Prc)
ContrBooth$p.value<-round(ContrBooth1$p.value,4)
names(ContrBooth)<-c("Test.Boot","p.Boot","EffSize.Boot")
ConEntre.b3<-data.table(Contr=c("Sleep on Young", "Sleep on Old", "Age on Control", "Age on SR"),ConEntre.b1,EfSize=ConEntre.b2,ContrBooth)
ExFin$Detall<-ConEntre.b3
#Extents Interaction AB
ConEntre.b3<-0
cnMM<-ContCAll(A=2,B=2,C=1,"Desgl.AB",CnSel<-c(2,3)) #ContAB2x2.Ext
Contr.1<-lincon(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$psihat[,5],4)
# Approximation to estimate Effect Size
DatSel<-DatPas[[1]][Sleep=="SR"&Age=="Young"|Sleep=="Control"&Age=="Old"]
AExtrP<-c("test","p.value","Effect.Size")
EffA<-parallel::mclapply(1:A, function(x) WRS2::yuen(DepV~Sleep,data=DatPas[[1]][Age==levels(Age)[x]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
EffB<-parallel::mclapply(1:B, function(x) WRS2::yuen(DepV~Age,data=DatPas[[1]][Sleep==levels(Sleep)[x]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
EffAb<-parallel::mclapply(1:A, function(x) WRS2::t1waybt(DepV~Sleep,data=DatPas[[1]][Age==levels(Age)[x]],nboot = 900)[AExtrP],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
EffBb<-parallel::mclapply(1:B, function(x) WRS2::t1waybt(DepV~Age,data=DatPas[[1]][Sleep==levels(Sleep)[x]],nboot = 900)[AExtrP],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
EffS5=WRS2::yuen(DepV~Age,data=DatSel)[6]
EffS5b=WRS2::t1waybt(DepV~Age,data=DatSel,nboot = 900)[AExtrP]
ConEntre.b2<-round(data.table(c(unlist(EffA),unlist(EffB),unlist(EffS5))),Prc)
ContrBooth1<-rbind(do.call(rbind, lapply(EffAb, as.data.table)),
do.call(rbind, lapply(EffBb, as.data.table)),
as.data.table(EffS5b))
ContrBooth<-round(ContrBooth1,Prc)
ContrBooth$p.value<-round(ContrBooth1$p.value,4)
names(ContrBooth)<-c("Test.Boot","p.Boot","EffSize.Boot")
ConEntre.b3<-data.table(Contr=c("Sleep on Young", "Sleep on Old", "Age on Control", "Age on SR", "YSR vs OC"),ConEntre.b1,EfSize=ConEntre.b2,ContrBooth)
ExFin$DetallExt<-ConEntre.b3
return(ExFin)
}
AOVMx<-function(A=2,B=2,C=4,DatPas,DatEfSp,nBMM1=10000,nBMM2=10000,Prc=2) {
# Omnibus design {2*2*(4*S)}
# bbwtrim, bbwtrimbt, bbwtrimbt_vMM
# ContC, rmmcp, rmmismcp, yuendv2
# En Ef Simples de A*B en cada Momento, como AOVBwF
ExFin<-list()
ResRo<-list()
# 1) ANOVA Omnibus
RsRb<-bbwtrim(A,B,C,DatPas[[2]])
ResRo$w<- round(c(RsRb$Qa.p.value, RsRb$Qb.p.value, RsRb$Qc.p.value, RsRb$Qab.p.value,RsRb$Qac.p.value,
RsRb$Qbc.p.value, RsRb$Qabc.p.value),4)
ResRo$BT<-c(bbwtrimbt(A,B,C,DatPas[[2]]))
APA.N1<-c(round(unlist(RsRb),4),round(unlist(ResRo$BT),4))
rr<-ExtrSig(ResRo$BT)
print(rr)
ResRo$BT_MM<-c(bbwtrimbt_vMM(A,B,C,DatPas[[2]],nboot = nBMM1))
ResRo$Rk1<- bdm2way(A,B,DatPas[[2]])
rr2=ExtrSig(ResRo$BT_MM)
print(rr2)
ExRsRbQ<-with(RsRb, round(c(Qa, Qb,Qc, Qab, Qac, Qbc, Qabc),Prc))
ExRsRbp<-with(RsRb, round(c(Qa.p.value, Qb.p.value,Qc.p.value, Qab.p.value, Qac.p.value, Qbc.p.value, Qabc.p.value),4))
ExFin$AOV<-data.table(ExRsRbQ,ExRsRbp,rr$p.V1,rr$p.Sig,rr2$p.V1,rr2$p.Sig)
names(ExFin$AOV)<-c("Q","p","pBoot","Sig","pBootMas","Sig2")
ExFin$AOV<-data.table(Names=c("Age","Sleep","Time","Age*Sleep","Age*Time","Sleep*Time","Age*Sleep*Time"),ExFin$AOV)
# 2) Main Effect of C (Time or Trial)
cnMM<-ContCAll(A=2,B=2,C=4,"Succ") #ContC()
Contr.1<-rmmcp(DatPas[[2]],con=cnMM)
Contr.1b<-rmmismcp(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$test[,3],4)
ConEntre.b1b<-as.data.table(cbind(round(Contr.1b$output[,2],Prc), round(Contr.1b$output[,3],4)))
names(ConEntre.b1b)<-c("Psihat2","p.value2")
ContrFunde<-cbind(ConEntre.b1,ConEntre.b1b)
ContrFunde<-ContrFunde[,-2]
ConEntre.b3Ap<-ContrFunde[,.(psihat,df=NA,test, p.value,Psihat2, p.value2)]
# Approximation to estimate Effect Size
EffS1=yuendv2(DatPas[[1]][,T1],DatPas[[1]][,T2])$Effect.Size
EffS2=yuendv2(DatPas[[1]][,T2],DatPas[[1]][,T3])$Effect.Size
EffS3=yuendv2(DatPas[[1]][,T3],DatPas[[1]][,T4])$Effect.Size
ConEntre.b2<-round(data.table(unlist(rbind(EffS1,EffS2,EffS3))),Prc)
ConEntre.b3<-data.table(Contr=c("M1-M2", "M2-M3", "M3-M4"),ContrFunde,EfSize=ConEntre.b2)
ExFin$DetallMainC<-ConEntre.b3
# 3) Learning (Time/Trial) on AB (each experimental condition)
cnMM.Ap<-ContCAll(A=2,B=2,C=4,"Succ.EfS") #ContABC.Learn
Contr.1<-rmmcp(DatPas[[2]],con=cnMM.Ap)
Contr.1b<-rmmismcp(DatPas[[2]],con=cnMM.Ap)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$test[,3],4)
ConEntre.b1b<-as.data.table(cbind(round(Contr.1b$output[,2],Prc), round(Contr.1b$output[,3],4)))
names(ConEntre.b1b)<-c("Psihat2","p.value2")
ContrFunde<-cbind(ConEntre.b1,ConEntre.b1b)
TestContr2<-rbind(yuendv2(DatPas[[1]][.("Young","Control"),T1],
DatPas[[1]][.("Young","Control"),T2])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Young","SR"),T1],
DatPas[[1]][.("Young","SR"),T2])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Old","Control"),T1],
DatPas[[1]][.("Old","Control"),T2])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Old","SR"),T1],
DatPas[[1]][.("Old","SR"),T2])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Young","Control"),T2],
DatPas[[1]][.("Young","Control"),T3])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Young","SR"),T2],
DatPas[[1]][.("Young","SR"),T3])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Old","Control"),T2],
DatPas[[1]][.("Old","Control"),T3])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Old","SR"),T2],
DatPas[[1]][.("Old","SR"),T3])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Young","Control"),T3],
DatPas[[1]][.("Young","Control"),T4])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Young","SR"),T3],
DatPas[[1]][.("Young","SR"),T4])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Old","Control"),T3],
DatPas[[1]][.("Old","Control"),T4])
[c("dif","df","teststat","Effect.Size","p.value")],
yuendv2(DatPas[[1]][.("Old","SR"),T3],
DatPas[[1]][.("Old","SR"),T4])
[c("dif","df","teststat","Effect.Size","p.value")])
ConEntre.b3Ap<-data.table(Contr=c("M1-M2 on Y_C", "M1-M2 on Y_SR", "M1-M2 on O_C", "M1-M2 on O_SR",
"M2-M3 on Y_C", "M2-M3 on Y_SR", "M2-M3 on O_C", "M2-M3 on O_SR",
"M3-M4 on Y_C", "M3-M4 on Y_SR", "M3-M4 on O_C", "M3-M4 on O_SR"),
ContrFunde)
ConEntre.b3Ap<-ConEntre.b3Ap[,-3]
ConEntre.b3Ap<-ConEntre.b3Ap[,.(Contr,psihat,df=NA,test, p.value,Psihat2, p.value2)]
rrF<-data.table(ConEntre.b3Ap,dif.yuen=round(unlist(TestContr2[,1]),Prc),df.yuen=unlist(TestContr2[,2]),
test.yuen=round(unlist(TestContr2[,3]),Prc),EffSize.yuen=round(unlist(TestContr2[,4]),Prc),
pvaluet.yuen=round(unlist(TestContr2[,5]),4))
ExFin$DetallTrialCadaCondAB<-rrF
# 4) Simple Effect AxB on each Trial/Time
ExFin$DetallSimple<-lapply(1:C, function (is) AOVBwF(2,2,DatPas = DatEfSp[[is]],nBMM2))
return(ExFin)
}
AOVMx2<-function(A=2,B=2,C=4,DatPas,DatEfSp,nBMM1=10000,nBMM2=10000,Prc=2) {
require(parallel);require(data.table)
# Omnibus design {2*2*(4*S)}
# bbwtrim, bbwtrimbt, bbwtrimbt_vMM
# ContC, rmmcp, rmmismcp, yuendv2
# En Ef Simples de A*B en cada Momento, como AOVBwF
ExFin<-list()
ResRo<-list()
# 1) ANOVA Omnibus
RsRb<-bbwtrim(A,B,C,DatPas[[2]])
ResRo$w<- round(c(RsRb$Qa.p.value, RsRb$Qb.p.value, RsRb$Qc.p.value, RsRb$Qab.p.value,RsRb$Qac.p.value,
RsRb$Qbc.p.value, RsRb$Qabc.p.value),4)
ResRo$BT<-c(bbwtrimbt(A,B,C,DatPas[[2]]))
APA.N1<-c(round(unlist(RsRb),4),round(unlist(ResRo$BT),4))
rr<-ExtrSig(ResRo$BT)
print(rr)
ResRo$BT_MM<-c(bbwtrimbt_vMM(A,B,C,DatPas[[2]],nboot = nBMM1))
ResRo$Rk1<- bdm2way(A,B,DatPas[[2]])
rr2=ExtrSig(ResRo$BT_MM)
print(rr2)
ExRsRbQ<-with(RsRb, round(c(Qa, Qb,Qc, Qab, Qac, Qbc, Qabc),Prc))
ExRsRbp<-with(RsRb, round(c(Qa.p.value, Qb.p.value,Qc.p.value, Qab.p.value, Qac.p.value, Qbc.p.value, Qabc.p.value),4))
ExFin$AOV<-data.table(ExRsRbQ,ExRsRbp,rr$p.V1,rr$p.Sig,rr2$p.V1,rr2$p.Sig)
names(ExFin$AOV)<-c("Q","p","pBoot","Sig","pBootMas","Sig2")
ExFin$AOV<-data.table(Names=c("Age","Sleep","Time","Age*Sleep","Age*Time","Sleep*Time","Age*Sleep*Time"),ExFin$AOV)
# 2) Interaction AB
# A on each B & B on each A
cnMM<-ContCAll(A=2,B=2,C=4,"Desgl.AB") #ContAB
Contr.1<-lincon(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$psihat[,5],4)
# Approximation to estimate Effect Size
DatPas[[1]][,NewIntra:=rowMeans(DatPas[[1]][,.(T1,T2,T3,T4)],na.rm = T)]
EffA<-parallel::mclapply(1:A, function(x) WRS2::yuen(NewIntra~Sleep,data=DatPas[[1]][Age==levels(Age)[x]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
EffB<-parallel::mclapply(1:B, function(x) WRS2::yuen(NewIntra~Age,data=DatPas[[1]][Sleep==levels(Sleep)[x]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(c(unlist(EffA),unlist(EffB))),Prc)
ConEntre.b3<-data.table(Contr=c("Sleep on Young", "Sleep on Old", "Age on Control",
"Age on SR"),ConEntre.b1,EfSize=ConEntre.b2)
ExFin$InterAB<-as.data.table(ConEntre.b3)
# 3) Interaction AC
# A on each Moment/Time/Trial of C
cnMM<-ContCAll(A=2,B=2,C=4,"AenC") #ContAC
Contr.1<-lincon(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$psihat[,5],4)
# Approximation to estimate Effect Size
levIS<-paste0("T",1:C)
EffS<-parallel::mclapply(1:C, function(x) WRS2::yuen(get(levIS[x])~Age,data=DatPas[[1]])[6],mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(unlist(EffS)),Prc)
ConEntre.b3<-data.table(Contr=c("Age on M1", "Age on M2", "Age on M3", "Age on M4"),ConEntre.b1,EfSize=ConEntre.b2)
# Learning on AC
cnMM.Ap<-ContCAll(A=2,B=2,C=4,"Succ.AC") #ContAC.Learn
Contr.1Ap<-rmmcp(DatPas[[2]],con=cnMM.Ap)
ConEntre.b1Ap<-round(as.data.table(cbind(Contr.1Ap$test,Contr.1Ap$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1Ap$p.value <-round(Contr.1Ap$test[,3],4)
# Approximation to estimate Effect Size
LosLv<-split(c(rep("T1",2),rep("T2",2),rep("T3",2),rep("T2",2),rep("T3",2),rep("T4",2)),1:6)
LosLv2<-rep(levels(DatPas[[1]]$Age),3)
EffSAp<- parallel::mclapply(1:6, function(x) yuendv2(DatPas[[1]][Age==LosLv2[x],get(LosLv[[x]][1])],
DatPas[[1]][Age==LosLv2[x],get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2Ap<-round(data.table(unlist(EffSAp)),Prc)
ConEntre.b3Ap<-data.table(Contr=c("M1-M2 on Young", "M1-M2 on Old", "M2-M3 on Young", "M2-M3 on Old",
"M3-M4 on Young", "M3-M4 on Old"),ConEntre.b1Ap,EfSize=ConEntre.b2Ap)
ConEntre.b3Ap<-ConEntre.b3Ap[,-3]
ConEntre.b3Ap<-ConEntre.b3Ap[,.(Contr,psihat,df=NA,test, p.value ,EfSize.V1)]
ConEntre.b3.Funde<-rbind(ConEntre.b3,ConEntre.b3Ap)
#write.csv2(as.data.table(ConEntre.b3.Funde),paste0(NmBas,"ContrAC.csv"))
ExFin$InterAC<-as.data.table(ConEntre.b3.Funde)
# 4) Interaction BC
# B on each Moment/Time/Trial C
cnMM.2<-ContCAll(A=2,B=2,C=4,"BenC") #ContBC
Contr.2<-lincon(DatPas[[2]],con= cnMM.2)
ConEntre.2.b1<-round(as.data.table(cbind(Contr.2$test,Contr.2$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.2.b1$p.value <-round(Contr.2$psihat[,5],4)
# Approximation to estimate Effect Size
levIS<-paste0("T",1:C)
EffS<-parallel::mclapply(1:C, function(x) WRS2::yuen(get(levIS[x])~Sleep,data=DatPas[[1]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.2.b2<-round(data.table(unlist(EffS)),Prc)
ConEntre.2.b3<-data.table(Contr=c("Sleep on M1", "Sleep on M2", "Sleep on M3",
"Sleep on M4"),ConEntre.2.b1,EfSize=ConEntre.2.b2)
# Learning on BC
cnMM.Ap2<-ContCAll(A=2,B=2,C=4,"Succ.BC") #ContBC.Learn
Contr.1Ap2<-rmmcp(DatPas[[2]],con=cnMM.Ap2)
ConEntre.b1Ap2<-round(as.data.table(cbind( Contr.1Ap2$test, Contr.1Ap2$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1Ap2$p.value <-round(Contr.1Ap2$test[,3],4)
# Approximation to estimate Effect Size
LosLv<-split(c(rep("T1",2),rep("T2",2),rep("T3",2),rep("T2",2),rep("T3",2),rep("T4",2)),1:6)
LosLv2<-rep(levels(DatPas[[1]]$Sleep),3)
EffSAp<- parallel::mclapply(1:6, function(x) yuendv2(DatPas[[1]][Sleep==LosLv2[x],get(LosLv[[x]][1])],
DatPas[[1]][Sleep==LosLv2[x],get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2Ap2<-round(data.table(unlist(EffSAp)),Prc)
ConEntre.b3Ap2<-data.table(Contr=c("M1-M2 on Control", "M1-M2 on SR", "M2-M3 on Control", "M2-M3 on SR",
"M3-M4 on Control", "M3-M4 on SR"),ConEntre.b1Ap2,EfSize=ConEntre.b2Ap2)
ConEntre.b3Ap2<-ConEntre.b3Ap2[,-3]
ConEntre.b3Ap2<-ConEntre.b3Ap2[,.(Contr,psihat,df=NA,test, p.value ,EfSize.V1)]
ConEntre.b3.Funde2<-rbind(ConEntre.2.b3,ConEntre.b3Ap2)
ExFin$InterBC<-as.data.table(ConEntre.b3.Funde2)
# 5) Main Effect of C (Trial/Moment/Time)
cnMM<-ContCAll(A=2,B=2,C=4,"Succ") #ContC()
Contr.1<-rmmcp(DatPas[[2]],con=cnMM)
Contr.1b<-rmmismcp(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$test[,3],4)
ConEntre.b1b<-as.data.table(cbind(round(Contr.1b$output[,2],Prc), round(Contr.1b$output[,3],4)))
names(ConEntre.b1b)<-c("Psihat2","p.value2")
ContrFunde<-cbind(ConEntre.b1,ConEntre.b1b)
ContrFunde<-ContrFunde[,-2]
ConEntre.b3Ap<-ContrFunde[,.(psihat,df=NA,test, p.value,Psihat2, p.value2)]
# Approximation to estimate Effect Size
LosLv<-split(c("T1","T2","T3","T2","T3","T4"),1:3)
EffSAp2<- parallel::mclapply(1:3, function(x) yuendv2(DatPas[[1]][,get(LosLv[[x]][1])],DatPas[[1]][,get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(unlist(EffSAp2)),Prc)
ConEntre.b3<-data.table(Contr=c("M1-M2", "M2-M3", "M3-M4"),ContrFunde,EfSize=ConEntre.b2)
ExFin$DetallMainC<-ConEntre.b3
# 6) Learning (successive Trial/Time/Moment) on AB (each experimental condition)
cnMM.Ap<-ContCAll(A=2,B=2,C=4,"Succ.EfS") #ContABC.Learn
Contr.1<-rmmcp(DatPas[[2]],con=cnMM.Ap)
Contr.1b<-rmmismcp(DatPas[[2]],con=cnMM.Ap)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$test[,3],4)
ConEntre.b1b<-as.data.table(cbind(round(Contr.1b$output[,2],Prc), round(Contr.1b$output[,3],4)))
names(ConEntre.b1b)<-c("Psihat2","p.value2")
ContrFunde<-cbind(ConEntre.b1,ConEntre.b1b)
DtIntra<-copy(DatPas[[1]]);
DtIntra[,Inter:=interaction(Age,Sleep)]
DtIntra$Inter<-factor(DtIntra$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
AExtr<-c("dif","df","teststat","Effect.Size","p.value")
LosLv<-split(c(rep("T1",4),rep("T2",4),rep("T3",4),rep("T2",4),rep("T3",4),rep("T4",4)),1:12)
LosLv2<-rep(levels(DtIntra$Inter),3)
EffSApC<- parallel::mclapply(1:12, function(x) yuendv2(DtIntra[Inter==LosLv2[x],get(LosLv[[x]][1])],
DtIntra[Inter==LosLv2[x],get(LosLv[[x]][2])])
[AExtr],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
TestContr2<-data.table(do.call(rbind, setNames(EffSApC,AExtr)))
ConEntre.b3Ap<-data.table(Contr=c("M1-M2 on Y_C", "M1-M2 on Y_SR", "M1-M2 on O_C", "M1-M2 on O_SR",
"M2-M3 on Y_C", "M2-M3 on Y_SR", "M2-M3 on O_C", "M2-M3 on O_SR",
"M3-M4 on Y_C", "M3-M4 on Y_SR", "M3-M4 on O_C", "M3-M4 on O_SR"),
ContrFunde)
ConEntre.b3Ap<-ConEntre.b3Ap[,-3]
ConEntre.b3Ap<-ConEntre.b3Ap[,.(Contr,psihat,df=NA,test, p.value,Psihat2, p.value2)]
rrF<-data.table(ConEntre.b3Ap,dif.yuen=round(unlist(TestContr2[,1]),Prc),df.yuen=unlist(TestContr2[,2]),
test.yuen=round(unlist(TestContr2[,3]),Prc),EffSize.yuen=round(unlist(TestContr2[,4]),Prc),
pvaluet.yuen=round(unlist(TestContr2[,5]),4))
ExFin$DetallTrialCadaCondAB<-rrF
# 7) Simple Simple Effect AxB on each Trial/Moment/Time
ExFin$DetallSimple<-parallel::mclapply(1:C, function (is) AOVBwF(2,2,DatPas = DatEfSp[[is]],nBMM2),
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
return(ExFin)
}
AOVMx2b<-function(A=2,C=4,DatPas,DatEfSp,nBMM1=10000,nBMM2=10000,Prc=2) {
require(parallel);require(data.table)
#A=2;C=4;DatPas = rrt;DatEfSp = DatEfS;nBMM1 = 10000;nBMM2 = 1000;Prc = 2
# Omnibus design {2*(4*S)} & {2*(5*S)}
# bbwtrim, bbwtrimbt, bbwtrimbt_vMM
# ContC, rmmcp, rmmismcp, yuendv2
# En Ef Simples de A*B en cada Momento, como AOVBwF
ExFin<-list()
ResRo<-list()
rr2<-rr<-list()
# 1) ANOVA Omnibus
RsRb<-bwtrim(A,C,DatPas[[2]])
ResRo$w<- round(c(RsRb$Qa.p.value, RsRb$Qb.p.value, RsRb$Qab.p.value),4)
ResRo$BT<-try(c(bwtrimbt(A,C,DatPas[[2]])))
APA.N1<-try(c(round(unlist(RsRb),Prc),round(unlist(ResRo$BT),Prc)))
rr<-try(ExtrSig(ResRo$BT))
#print(rr)
ResRo$BT_MM<-try(c(bwtrimbt(A,C,DatPas[[2]],nboot = nBMM1)))
rr2=try(ExtrSig(ResRo$BT_MM))
#print(rr2)
is_try_error <- function(x) inherits(x, "try-error")
if (is_try_error(rr)) {rr<-list();rr$p.V1<-NA;rr$p.Sig<-NA}
if (is_try_error(rr2)) {rr2<-list();rr2$p.V1<-NA;rr2$p.Sig<-NA}
ExRsRbp<-with(RsRb, round(c(Qa.p.value, Qb.p.value,Qab.p.value),4))
ExRsRbQ<-with(RsRb, round(c(Qa, Qb, Qab),Prc))
ExFin$AOV<-data.table(ExRsRbQ,ExRsRbp,rr$p.V1,rr$p.Sig,rr2$p.V1,rr2$p.Sig)
names(ExFin$AOV)<-c("Q","p","pBoot","Sig","pBootMas","Sig2")
ExFin$AOV<-data.table(Names=c("Age","Trial","Age*Trial"),ExFin$AOV)
TamA=round(mean(ESmainMCP(A,C,DatPas[[2]])$Factor.A[,3]),Prc)
TamB=round(mean(ESmainMCP(A,C,DatPas[[2]])$Factor.B[,3]),Prc)
TamInt=round(mean(esImcp(A,C,DatPas[[2]])$Effect.Sizes),Prc)
ExFin$AOV[,EffSize:=c(TamA,TamB,TamInt)]
# 2) Interaction AB
# A on each C & C on each A
cnMM<-ContCAll(A=A,B=1,C=C,"AenC") #ContAenBMixto
Contr.1<-lincon(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$psihat[,5],4)
# A on each C
# Approximation to estimate Effect Size
levIS<-paste0("T",1:C)
EffS<-parallel::mclapply(1:C, function(x) WRS2::yuen(get(levIS[x])~Group,data=DatPas[[1]])[6],mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(unlist(EffS)),Prc)
ConEntre.b3<-data.table(Contr=c(paste0("Age on M",1:C)),ConEntre.b1,EfSize=ConEntre.b2)
# Learning (successive Time/Moment/Trial) on AC
cnMM.Ap<-ContCAll(A=A,B=1,C=C,"Succ.AC") #ContBenAMixto
Contr.1Ap<-rmmcp(DatPas[[2]],con=cnMM.Ap)
ConEntre.b1Ap<-round(as.data.table(cbind(Contr.1Ap$test,Contr.1Ap$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1Ap$p.value <-round(Contr.1Ap$test[,3],4)
# C on each A
# Approximation to estimate Effect Size
if (C==4) {
LosLv<-split(c(rep("T1",2),rep("T2",2),rep("T3",2),rep("T2",2),rep("T3",2),rep("T4",2)),1:6)
LosLv2<-rep(levels(DatPas[[1]]$Group),3)
EffSAp<- parallel::mclapply(1:6, function(x) yuendv2(DatPas[[1]][Group==LosLv2[x],get(LosLv[[x]][1])],
DatPas[[1]][Group==LosLv2[x],get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2Ap<-round(data.table(unlist(EffSAp)),Prc)
ConEntre.b3Ap<-data.table(Contr=c("M1-M2 on Young", "M1-M2 on Old", "M2-M3 on Young", "M2-M3 on Old",
"M3-M4 on Young", "M3-M4 on Old"),ConEntre.b1Ap,EfSize=ConEntre.b2Ap)
}
if (C==5) {
LosLv<-split(c(rep("T1",2),rep("T2",2),rep("T3",2),rep("T4",2),rep("T2",2),rep("T3",2),rep("T4",2),rep("T5",2)),1:8)
LosLv2<-rep(levels(DatPas[[1]]$Group),4)
EffSAp<- parallel::mclapply(1:8, function(x) yuendv2(DatPas[[1]][Group==LosLv2[x],get(LosLv[[x]][1])],
DatPas[[1]][Group==LosLv2[x],get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2Ap<-round(data.table(unlist(EffSAp)),Prc)
ConEntre.b3Ap<-data.table(Contr=c("M1-M2 on Young", "M1-M2 on Old", "M2-M3 on Young", "M2-M3 on Old",
"M3-M4 on Young", "M3-M4 on Old", "M4-M5 on Young", "M4-M5 on Old"),
ConEntre.b1Ap,EfSize=ConEntre.b2Ap)
}
ConEntre.b3Ap<-ConEntre.b3Ap[,-3]
ConEntre.b3Ap<-ConEntre.b3Ap[,.(Contr,psihat,df=NA,test, p.value ,EfSize.V1)]
ConEntre.b3.Funde<-rbind(ConEntre.b3,ConEntre.b3Ap)
#write.csv2(as.data.table(ConEntre.b3.Funde),paste0(NmBas,"ContrAC.csv"))
ExFin$InterAC<-as.data.table(ConEntre.b3.Funde)
# 3) Main Effect of C (Trial/Moment/Time)
cnMM<-ContCAll(A=A,B=1,C=C,"Succ") #ContC.3b
Contr.1<-rmmcp(DatPas[[2]],con=cnMM)
Contr.1b<-rmmismcp(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$test[,3],4)
ConEntre.b1b<-as.data.table(cbind(round(Contr.1b$output[,2],Prc), round(Contr.1b$output[,3],4)))
names(ConEntre.b1b)<-c("Psihat2","p.value2")
ContrFunde<-cbind(ConEntre.b1,ConEntre.b1b)
ContrFunde<-ContrFunde[,-2]
ConEntre.b3Ap<-ContrFunde[,.(psihat,df=NA,test, p.value,Psihat2, p.value2)]
# Approximation to estimate Effect Size
if (C==4) {
LosLv<-split(c("T1","T2","T3","T2","T3","T4"),1:3)
EffSAp2<- parallel::mclapply(1:3, function(x) yuendv2(DatPas[[1]][,get(LosLv[[x]][1])],DatPas[[1]][,get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(unlist(EffSAp2)),Prc)
ConEntre.b3<-data.table(Contr=c("M1-M2", "M2-M3", "M3-M4"),ContrFunde,EfSize=ConEntre.b2)
}
if (C==5) {
LosLv<-split(c("T1","T2","T3","T4","T2","T3","T4","T5"),1:4)
EffSAp2<- parallel::mclapply(1:4, function(x) yuendv2(DatPas[[1]][,get(LosLv[[x]][1])],DatPas[[1]][,get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(unlist(EffSAp2)),Prc)
ConEntre.b3<-data.table(Contr=c("M1-M2", "M2-M3", "M3-M4", "M4-M5"),ContrFunde,EfSize=ConEntre.b2)
}
ExFin$DetallMainC<-ConEntre.b3
return(ExFin)
}
AOVMx2.2<-function(A=2,B=2,C=2,DatPas,DatEfSp,nBMM1=10000,nBMM2=10000,Prc=2) {
require(parallel);require(data.table)
# Variant for Intra variable of 2 levels
# Omnibus design {2*2*(2*S)}
# bbwtrim, bbwtrimbt, bbwtrimbt_vMM
# ContC, rmmcp, rmmismcp, yuendv2
# On Simple Effects of AxB on each Moment/Trual/Moment, as in AOVBwF
ExFin<-list()
ResRo<-list()
# 1) ANOVA Omnibus
RsRb<-bbwtrim(A,B,C,DatPas[[2]])
ResRo$w<- round(c(RsRb$Qa.p.value, RsRb$Qb.p.value, RsRb$Qc.p.value, RsRb$Qab.p.value,RsRb$Qac.p.value,
RsRb$Qbc.p.value, RsRb$Qabc.p.value),4)
ResRo$BT<-c(bbwtrimbt(A,B,C,DatPas[[2]]))
APA.N1<-c(round(unlist(RsRb),4),round(unlist(ResRo$BT),4))
rr<-ExtrSig(ResRo$BT)
print(rr)
ResRo$BT_MM<-c(bbwtrimbt_vMM(A,B,C,DatPas[[2]],nboot = nBMM1))
ResRo$Rk1<- bdm2way(A,B,DatPas[[2]])
rr2=ExtrSig(ResRo$BT_MM)
print(rr2)
ExRsRbQ<-with(RsRb, round(c(Qa, Qb,Qc, Qab, Qac, Qbc, Qabc),Prc))
ExRsRbp<-with(RsRb, round(c(Qa.p.value, Qb.p.value,Qc.p.value, Qab.p.value, Qac.p.value, Qbc.p.value, Qabc.p.value),4))
ExFin$AOV<-data.table(ExRsRbQ,ExRsRbp,rr$p.V1,rr$p.Sig,rr2$p.V1,rr2$p.Sig)
names(ExFin$AOV)<-c("Q","p","pBoot","Sig","pBootMas","Sig2")
ExFin$AOV<-data.table(Names=c("Age","Sleep","Time","Age*Sleep","Age*Time","Sleep*Time","Age*Sleep*Time"),ExFin$AOV)
# 2) Interacion AB
# A on each B & B on each A
cnMM<-ContCAll(A=2,B=2,C=2,"Desgl.AB") #ContAB.2Intra
Contr.1<-lincon(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$psihat[,5],4)
# Approximation to estimate Effect Size
DatPas[[1]][,NewIntra:=rowMeans(DatPas[[1]][,.(T1,T2)],na.rm = T)]
EffA<-parallel::mclapply(1:A, function(x) WRS2::yuen(NewIntra~Sleep,data=DatPas[[1]][Age==levels(Age)[x]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
EffB<-parallel::mclapply(1:B, function(x) WRS2::yuen(NewIntra~Age,data=DatPas[[1]][Sleep==levels(Sleep)[x]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(c(unlist(EffA),unlist(EffB))),Prc)
ConEntre.b3<-data.table(Contr=c("Sleep on Young", "Sleep on Old", "Age on Control",
"Age on SR"),ConEntre.b1,EfSize=ConEntre.b2)
ExFin$InterAB<-as.data.table(ConEntre.b3)
# 3) Interaction AC
# A on each C
cnMM<-ContCAll(A=2,B=2,C=2,"AenC") #ContAC.2Intra
Contr.1<-lincon(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$psihat[,5],4)
# Approximation to estimate Effect Size
levIS<-paste0("T",1:C)
EffS<-parallel::mclapply(1:C, function(x) WRS2::yuen(get(levIS[x])~Age,data=DatPas[[1]])[6],mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(unlist(EffS)),Prc)
ConEntre.b3<-data.table(Contr=c("Age on M1", "Age on M2"),ConEntre.b1,EfSize=ConEntre.b2)
# Learning (successive) on AC
cnMM.Ap<-ContCAll(A=2,B=2,C=2,"Succ.AC") #ContAC.2Learn
Contr.1Ap<-rmmcp(DatPas[[2]],con=cnMM.Ap)
ConEntre.b1Ap<-round(as.data.table(cbind(Contr.1Ap$test,Contr.1Ap$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1Ap$p.value <-round(Contr.1Ap$test[,3],4)
# Approximation to estimate Effect Size
LosLv<-split(c(rep("T1",2),rep("T2",2)),1:2)
LosLv2<-rep(levels(DatPas[[1]]$Age),1)
EffSAp<- parallel::mclapply(1:2, function(x) yuendv2(DatPas[[1]][Age==LosLv2[x],get(LosLv[[x]][1])],
DatPas[[1]][Age==LosLv2[x],get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2Ap<-round(data.table(unlist(EffSAp)),Prc)
ConEntre.b3Ap<-data.table(Contr=c("M1-M2 on Young", "M1-M2 on Old"),ConEntre.b1Ap,EfSize=ConEntre.b2Ap)
ConEntre.b3Ap<-ConEntre.b3Ap[,-3]
ConEntre.b3Ap<-ConEntre.b3Ap[,.(Contr,psihat,df=NA,test, p.value ,EfSize.V1)]
ConEntre.b3.Funde<-rbind(ConEntre.b3,ConEntre.b3Ap)
#write.csv2(as.data.table(ConEntre.b3.Funde),paste0(NmBas,"ContrAC.csv"))
ExFin$InterAC<-as.data.table(ConEntre.b3.Funde)
# 4) Interaction BC
# B on each C
cnMM.2<-ContCAll(A=2,B=2,C=2,"BenC") #ContBC.2Intra
Contr.2<-lincon(DatPas[[2]],con= cnMM.2)
ConEntre.2.b1<-round(as.data.table(cbind(Contr.2$test,Contr.2$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.2.b1$p.value <-round(Contr.2$psihat[,5],4)
# Approximation to estimate Effect Size
levIS<-paste0("T",1:C)
EffS<-parallel::mclapply(1:C, function(x) WRS2::yuen(get(levIS[x])~Sleep,data=DatPas[[1]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.2.b2<-round(data.table(unlist(EffS)),Prc)
ConEntre.2.b3<-data.table(Contr=c("Sleep on M1", "Sleep on M2"),ConEntre.2.b1,EfSize=ConEntre.2.b2)
# Learning (successive) on BC
cnMM.Ap2<-ContCAll(A=2,B=2,C=2,"Succ.BC") #ContBC.2Learn
Contr.1Ap2<-rmmcp(DatPas[[2]],con=cnMM.Ap2)
ConEntre.b1Ap2<-round(as.data.table(cbind( Contr.1Ap2$test, Contr.1Ap2$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1Ap2$p.value <-round(Contr.1Ap2$test[,3],4)
# Approximation to estimate Effect Size
LosLv<-split(c(rep("T1",2),rep("T2",2)),1:2)
LosLv2<-rep(levels(DatPas[[1]]$Sleep),1)
EffSAp<- parallel::mclapply(1:2, function(x) yuendv2(DatPas[[1]][Sleep==LosLv2[x],get(LosLv[[x]][1])],
DatPas[[1]][Sleep==LosLv2[x],get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2Ap2<-round(data.table(unlist(EffSAp)),Prc)
ConEntre.b3Ap2<-data.table(Contr=c("M1-M2 on Control", "M1-M2 on SR"),ConEntre.b1Ap2,EfSize=ConEntre.b2Ap2)
ConEntre.b3Ap2<-ConEntre.b3Ap2[,-3]
ConEntre.b3Ap2<-ConEntre.b3Ap2[,.(Contr,psihat,df=NA,test, p.value ,EfSize.V1)]
ConEntre.b3.Funde2<-rbind(ConEntre.2.b3,ConEntre.b3Ap2)
#write.csv2(as.data.table(ConEntre.b3.Funde2),paste0(NmBas,"ContrBC.csv"))
ExFin$InterBC<-as.data.table(ConEntre.b3.Funde2)
# 5) Main Effect of C (Trial/Moment/Time) which I keep although it is not necessary because C = 2
cnMM<-ContCAll(A=2,B=2,C=2,"Succ") #ContC.2
Contr.1<-rmmcp(DatPas[[2]],con=cnMM)
Contr.1b<-rmmismcp(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$test[,3],4)
ConEntre.b1b<-as.data.table(cbind(round(Contr.1b$output[,2],Prc), round(Contr.1b$output[,3],4)))
names(ConEntre.b1b)<-c("Psihat2","p.value2")
ContrFunde<-cbind(ConEntre.b1,ConEntre.b1b)
ContrFunde<-ContrFunde[,-2]
ConEntre.b3Ap<-ContrFunde[,.(psihat,df=NA,test, p.value,Psihat2, p.value2)]
# Approximation to estimate Effect Size
LosLv<-c("T1","T2")
EffSAp2<- parallel::mclapply(1:1, function(x) yuendv2(DatPas[[1]][,get(LosLv[1])],DatPas[[1]][,get(LosLv[2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(unlist(EffSAp2)),Prc)
ConEntre.b3<-data.table(Contr=c("M1-M2"),ContrFunde,EfSize=ConEntre.b2)
ExFin$DetallMainC<-ConEntre.b3
# 6) Learning (successive Trial/Moment/Time) on AB (each experimental condition)
cnMM.Ap<-ContCAll(A=2,B=2,C=2,"Succ.EfS") #ContABC.2Learn
Contr.1<-rmmcp(DatPas[[2]],con=cnMM.Ap)
Contr.1b<-rmmismcp(DatPas[[2]],con=cnMM.Ap)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$test[,3],4)
ConEntre.b1b<-as.data.table(cbind(round(Contr.1b$output[,2],Prc), round(Contr.1b$output[,3],4)))
names(ConEntre.b1b)<-c("Psihat2","p.value2")
ContrFunde<-cbind(ConEntre.b1,ConEntre.b1b)
DtIntra<-copy(DatPas[[1]]);
DtIntra[,Inter:=interaction(Age,Sleep)]
DtIntra$Inter<-factor(DtIntra$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
AExtr<-c("dif","df","teststat","Effect.Size","p.value")
LosLv<-split(c(rep("T1",4),rep("T2",4)),1:4)
LosLv2<-rep(levels(DtIntra$Inter),1)
x=2
EffSApC<- parallel::mclapply(1:4, function(x) yuendv2(DtIntra[Inter==LosLv2[x],get(LosLv[[x]][1])],
DtIntra[Inter==LosLv2[x],get(LosLv[[x]][2])])
[AExtr],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
TestContr2<-data.table(rbind(unlist(EffSApC[[1]]),unlist(EffSApC[[2]]),unlist(EffSApC[[3]]),unlist(EffSApC[[4]])))
ConEntre.b3Ap<-data.table(Contr=c("M1-M2 on Y_C", "M1-M2 on Y_SR", "M1-M2 on O_C", "M1-M2 on O_SR"),
ContrFunde)
ConEntre.b3Ap<-ConEntre.b3Ap[,-3]
ConEntre.b3Ap<-ConEntre.b3Ap[,.(Contr,psihat,df=NA,test, p.value,Psihat2, p.value2)]
rrF<-data.table(ConEntre.b3Ap,dif.yuen=round(unlist(TestContr2[,1]),Prc),df.yuen=unlist(TestContr2[,2]),
test.yuen=round(unlist(TestContr2[,3]),Prc),EffSize.yuen=round(unlist(TestContr2[,4]),Prc),
pvaluet.yuen=round(unlist(TestContr2[,5]),4))
ExFin$DetallTrialCadaCondAB<-rrF
# 7) Simple Simple Effect AxB on each Trial/Moment/Time
ExFin$DetallSimple<-parallel::mclapply(1:C, function (is) AOVBwF(2,2,DatPas = DatEfSp[[is]],nBMM2),
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
return(ExFin)
}
AOVMx2.5<-function(A=2,B=2,C=5,DatPas,DatEfSp,nBMM1=10000,nBMM2=10000,Prc=2) {
require(parallel);require(data.table)
# Variant for Intra variable of 5 levels
# Omnibus design {2*2*(5*S)}
# bbwtrim, bbwtrimbt, bbwtrimbt_vMM
# ContC, rmmcp, rmmismcp, yuendv2
# On Simple Effects of AxB on each Moment/Trual/Moment, as in AOVBwF
ExFin<-list()
ResRo<-list()
# 1) ANOVA Omnibus
RsRb<-bbwtrim(A,B,C,DatPas[[2]])
ResRo$w<- round(c(RsRb$Qa.p.value, RsRb$Qb.p.value, RsRb$Qc.p.value, RsRb$Qab.p.value,RsRb$Qac.p.value,
RsRb$Qbc.p.value, RsRb$Qabc.p.value),4)
ResRo$BT<-c(bbwtrimbt(A,B,C,DatPas[[2]]))
APA.N1<-c(round(unlist(RsRb),4),round(unlist(ResRo$BT),4))
rr<-ExtrSig(ResRo$BT)
print(rr)
ResRo$BT_MM<-c(bbwtrimbt_vMM(A,B,C,DatPas[[2]],nboot = nBMM1))
ResRo$Rk1<- bdm2way(A,B,DatPas[[2]])
rr2=ExtrSig(ResRo$BT_MM)
print(rr2)
ExRsRbQ<-with(RsRb, round(c(Qa, Qb,Qc, Qab, Qac, Qbc, Qabc),Prc))
ExRsRbp<-with(RsRb, round(c(Qa.p.value, Qb.p.value,Qc.p.value, Qab.p.value, Qac.p.value, Qbc.p.value, Qabc.p.value),4))
ExFin$AOV<-data.table(ExRsRbQ,ExRsRbp,rr$p.V1,rr$p.Sig,rr2$p.V1,rr2$p.Sig)
names(ExFin$AOV)<-c("Q","p","pBoot","Sig","pBootMas","Sig2")
ExFin$AOV<-data.table(Names=c("Age","Sleep","Time","Age*Sleep","Age*Time","Sleep*Time","Age*Sleep*Time"),ExFin$AOV)
# 2) Interaction AB
# A on each B & B on each A
cnMM<-ContCAll(A=2,B=2,C=5,"Desgl.AB") #ContAB.5
Contr.1<-lincon(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$psihat[,5],4)
# Approximation to estimate Effect Size
DatPas[[1]][,NewIntra:=rowMeans(DatPas[[1]][,.(T1,T2,T3,T4,T5)],na.rm = T)]
EffA<-parallel::mclapply(1:A, function(x) WRS2::yuen(NewIntra~Sleep,data=DatPas[[1]][Age==levels(Age)[x]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
EffB<-parallel::mclapply(1:B, function(x) WRS2::yuen(NewIntra~Age,data=DatPas[[1]][Sleep==levels(Sleep)[x]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(c(unlist(EffA),unlist(EffB))),Prc)
ConEntre.b3<-data.table(Contr=c("Sleep on Young", "Sleep on Old", "Age on Control",
"Age on SR"),ConEntre.b1,EfSize=ConEntre.b2)
ExFin$InterAB<-as.data.table(ConEntre.b3)
# 3) Interaction AC
# A on each Moment/Time/Trial of C
cnMM<-ContCAll(A=2,B=2,C=5,"AenC") #ContAC.5
Contr.1<-lincon(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$psihat[,5],4)
# Approximation to estimate Effect Size
levIS<-paste0("T",1:C)
EffS<-parallel::mclapply(1:C, function(x) WRS2::yuen(get(levIS[x])~Age,data=DatPas[[1]])[6],mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(unlist(EffS)),Prc)
ConEntre.b3<-data.table(Contr=c("Age on M1", "Age on M2", "Age on M3", "Age on M4","Age on M5"),ConEntre.b1,EfSize=ConEntre.b2)
# Learning (successive Trial/Time/Moment) on AC
cnMM.Ap<-ContCAll(A=2,B=2,C=5,"Succ.AC") #ContAC.5Learn
Contr.1Ap<-rmmcp(DatPas[[2]],con=cnMM.Ap)
ConEntre.b1Ap<-round(as.data.table(cbind(Contr.1Ap$test,Contr.1Ap$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1Ap$p.value <-round(Contr.1Ap$test[,3],4)
# Approximation to estimate Effect Size
LosLv<-split(c(rep("T1",2),rep("T2",2),rep("T3",2),rep("T4",2),rep("T2",2),rep("T3",2),rep("T4",2),rep("T5",2)),1:8)
LosLv2<-rep(levels(DatPas[[1]]$Age),4)
EffSAp<- parallel::mclapply(1:8, function(x) yuendv2(DatPas[[1]][Age==LosLv2[x],get(LosLv[[x]][1])],
DatPas[[1]][Age==LosLv2[x],get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2Ap<-round(data.table(unlist(EffSAp)),Prc)
ConEntre.b3Ap<-data.table(Contr=c("M1-M2 on Young", "M1-M2 on Old", "M2-M3 on Young", "M2-M3 on Old",
"M3-M4 on Young", "M3-M4 on Old", "M4-M5 on Young", "M4-M5 on Old"),
ConEntre.b1Ap,EfSize=ConEntre.b2Ap)
ConEntre.b3Ap<-ConEntre.b3Ap[,-3]
ConEntre.b3Ap<-ConEntre.b3Ap[,.(Contr,psihat,df=NA,test, p.value ,EfSize.V1)]
ConEntre.b3.Funde<-rbind(ConEntre.b3,ConEntre.b3Ap)
ExFin$InterAC<-as.data.table(ConEntre.b3.Funde)
# 4) Interaction BC
# B on each C
cnMM.2<-ContCAll(A=2,B=2,C=5,"BenC") #ContBC.5
Contr.2<-lincon(DatPas[[2]],con= cnMM.2)
ConEntre.2.b1<-round(as.data.table(cbind(Contr.2$test,Contr.2$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.2.b1$p.value <-round(Contr.2$psihat[,5],4)
# Approximation to estimate Effect Size
levIS<-paste0("T",1:C)
EffS<-parallel::mclapply(1:C, function(x) WRS2::yuen(get(levIS[x])~Sleep,data=DatPas[[1]])[6],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.2.b2<-round(data.table(unlist(EffS)),Prc)
ConEntre.2.b3<-data.table(Contr=c("Sleep on M1", "Sleep on M2", "Sleep on M3",
"Sleep on M4", "Sleep on M5"),ConEntre.2.b1,EfSize=ConEntre.2.b2)
# Learning (successive Time/Trial/Moment) on BC
cnMM.Ap2<-ContCAll(A=2,B=2,C=5,"Succ.BC") #ContBC.5Learn
Contr.1Ap2<-rmmcp(DatPas[[2]],con=cnMM.Ap2)
ConEntre.b1Ap2<-round(as.data.table(cbind( Contr.1Ap2$test, Contr.1Ap2$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1Ap2$p.value <-round(Contr.1Ap2$test[,3],4)
# Approximation to estimate Effect Size
LosLv<-split(c(rep("T1",2),rep("T2",2),rep("T3",2),rep("T4",2),rep("T2",2),rep("T3",2),rep("T4",2),rep("T5",2)),1:8)
LosLv2<-rep(levels(DatPas[[1]]$Sleep),4)
EffSAp<- parallel::mclapply(1:8, function(x) yuendv2(DatPas[[1]][Sleep==LosLv2[x],get(LosLv[[x]][1])],
DatPas[[1]][Sleep==LosLv2[x],get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2Ap2<-round(data.table(unlist(EffSAp)),Prc)
ConEntre.b3Ap2<-data.table(Contr=c("M1-M2 on Young", "M1-M2 on Old", "M2-M3 on Young", "M2-M3 on Old",
"M3-M4 on Young", "M3-M4 on Old", "M4-M5 on Young", "M4-M5 on Old"),
ConEntre.b1Ap2,EfSize=ConEntre.b2Ap2)
ConEntre.b3Ap2<-ConEntre.b3Ap2[,-3]
ConEntre.b3Ap2<-ConEntre.b3Ap2[,.(Contr,psihat,df=NA,test, p.value ,EfSize.V1)]
ConEntre.b3.Funde2<-rbind(ConEntre.2.b3,ConEntre.b3Ap2)
ExFin$InterBC<-as.data.table(ConEntre.b3.Funde2)
# 5) Main Effect of C (Trial/Moment/Time)
cnMM<-ContCAll(A=2,B=2,C=5,"Succ") #ContC.5
Contr.1<-rmmcp(DatPas[[2]],con=cnMM)
Contr.1b<-rmmismcp(DatPas[[2]],con=cnMM)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$test[,3],4)
ConEntre.b1b<-as.data.table(cbind(round(Contr.1b$output[,2],Prc), round(Contr.1b$output[,3],4)))
names(ConEntre.b1b)<-c("Psihat2","p.value2")
ContrFunde<-cbind(ConEntre.b1,ConEntre.b1b)
ContrFunde<-ContrFunde[,-2]
ConEntre.b3Ap<-ContrFunde[,.(psihat,df=NA,test, p.value,Psihat2, p.value2)]
# Approximation to estimate Effect Size
LosLv<-split(c("T1","T2","T3","T4","T2","T3","T4","T5"),1:4)
EffSAp2<- parallel::mclapply(1:4, function(x) yuendv2(DatPas[[1]][,get(LosLv[[x]][1])],DatPas[[1]][,get(LosLv[[x]][2])])$Effect.Size,
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
ConEntre.b2<-round(data.table(unlist(EffSAp2)),Prc)
ConEntre.b3<-data.table(Contr=c("M1-M2", "M2-M3", "M3-M4", "M4-M5"),ContrFunde,EfSize=ConEntre.b2)
ExFin$DetallMainC<-ConEntre.b3
# 6) Learning (successive Trial/Moment/time) on AB (each experimental condition)
cnMM.Ap<-ContCAll(A=2,B=2,C=5,"Succ.EfS") #ContABC.5Learn
Contr.1<-rmmcp(DatPas[[2]],con=cnMM.Ap)
Contr.1b<-rmmismcp(DatPas[[2]],con=cnMM.Ap)
ConEntre.b1<-round(as.data.table(cbind(Contr.1$test,Contr.1$psihat)),Prc)[,.(psihat,df,test,p.value)]
ConEntre.b1$p.value <-round(Contr.1$test[,3],4)
ConEntre.b1b<-as.data.table(cbind(round(Contr.1b$output[,2],Prc), round(Contr.1b$output[,3],4)))
names(ConEntre.b1b)<-c("Psihat2","p.value2")
ContrFunde<-cbind(ConEntre.b1,ConEntre.b1b)
DtIntra<-copy(DatPas[[1]]);
DtIntra[,Inter:=interaction(Age,Sleep)]
DtIntra$Inter<-factor(DtIntra$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
AExtr<-c("dif","df","teststat","Effect.Size","p.value")
LosLv<-split(c(rep("T1",4),rep("T2",4),rep("T3",4),rep("T4",4),rep("T2",4),rep("T3",4),rep("T4",4),rep("T5",4)),1:16)
LosLv2<-rep(levels(DtIntra$Inter),4)
EffSApC<- parallel::mclapply(1:16, function(x) yuendv2(DtIntra[Inter==LosLv2[x],get(LosLv[[x]][1])],
DtIntra[Inter==LosLv2[x],get(LosLv[[x]][2])])
[AExtr],
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
TestContr2<-data.table(do.call(rbind, setNames(EffSApC,AExtr)))
ConEntre.b3Ap<-data.table(Contr=c("M1-M2 on Y_C", "M1-M2 on Y_SR", "M1-M2 on O_C", "M1-M2 on O_SR",
"M2-M3 on Y_C", "M2-M3 on Y_SR", "M2-M3 on O_C", "M2-M3 on O_SR",
"M3-M4 on Y_C", "M3-M4 on Y_SR", "M3-M4 on O_C", "M3-M4 on O_SR",
"M4-M5 on Y_C", "M4-M5 on Y_SR", "M4-M5 on O_C", "M4-M5 on O_SR"),
ContrFunde)
ConEntre.b3Ap<-ConEntre.b3Ap[,-3]
ConEntre.b3Ap<-ConEntre.b3Ap[,.(Contr,psihat,df=NA,test, p.value,Psihat2, p.value2)]
rrF<-data.table(ConEntre.b3Ap,dif.yuen=round(unlist(TestContr2[,1]),Prc),df.yuen=unlist(TestContr2[,2]),
test.yuen=round(unlist(TestContr2[,3]),Prc),EffSize.yuen=round(unlist(TestContr2[,4]),Prc),
pvaluet.yuen=round(unlist(TestContr2[,5]),4))
ExFin$DetallTrialCadaCondAB<-rrF
# 7) Simple Simple Effect AxB on each Trial/Time/Moment
ExFin$DetallSimple<-parallel::mclapply(1:C, function (is) AOVBwF(2,2,DatPas = DatEfSp[[is]],nBMM2),
mc.cores = parallel::detectCores(), mc.allow.recursive = TRUE)
return(ExFin)
}
AlmacenGen<-function(GrpP,Grp2P=GrpP,DataPas, PathDesignP, NmBasP,Typ=1){
NmFAl<-paste0(PathDesignP,NmBasP)
if (!dir.exists(NmFAl)) {dir.create(NmFAl)}
NmFAl<-paste0(NmFAl,"/")
pdf(paste0(NmFAl,NmBasP,".pdf"),family = "ArialMT")
plot(GrpP)
dev.off()
pdf(paste0(NmFAl,NmBasP,"_Asterisk.pdf"),family = "ArialMT")
plot(Grp2P)
dev.off()
png(paste0(NmFAl,NmBasP,".png"),width = 1200, height = 1000,family = "ArialMT")
plot(GrpP)
dev.off()
png(paste0(NmFAl,NmBasP,"_Asterisk.png"),width = 1200, height = 1000,family = "ArialMT")
plot(Grp2P)
dev.off()
rtffile <- RTF(paste0(NmFAl,NmBasP,"AllStats.doc"))
if (length(DataPas)<2 & Typ==1){
write.csv2(as.data.table(DataPas[[1]]),paste0(NmFAl,NmBasP,"ResStat",1,"_",names(DataPas)[1],".csv"))
addText(rtffile,paste0("Overall_",names(DataPas)[1]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[1]]));
addNewLine(rtffile)
}
if (length(DataPas)>2 & Typ==2){
for (i in 1:3) {
write.csv2(as.data.table(DataPas[[i]]),paste0(NmFAl,NmBasP,"ResStat",i,"_",names(DataPas)[i],".csv"))
addText(rtffile,paste0("Overall_",names(DataPas)[i]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[i]]));
addNewLine(rtffile)
}
}
cont<-3
if (length(DataPas)>2 & Typ==1){
for (i in 1:length(DataPas)) {
write.csv2(as.data.table(DataPas[[i]]),paste0(NmFAl,NmBasP,"ResStat",i,"_",names(DataPas)[i],".csv"))
addText(rtffile,paste0("Overall_",names(DataPas)[i]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[i]]));
addNewLine(rtffile)
}
}
if (length(DataPas)>2 & Typ==2){
for (j in 1:length(DataPas[[4]])) {
for (k in 1:length(DataPas[[4]][[j]])) {
cont<-cont+1
write.csv2(as.data.table(DataPas[[4]][[j]][[k]]),paste0(NmFAl,NmBasP,"ResStat",cont,"_Cond",j,
names(DataPas[[4]][[j]])[k],".csv"))
addText(rtffile,paste0("Simple Effect A*B on Time_","_Cond",j,names(DataPas[[4]][[j]])[k]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[4]][[j]][[k]]));
addNewLine(rtffile)
}
}
}
addPlot(rtffile,plot.fun=print,width=6,height=6,res=600, GrpP)
addNewLine(rtffile)
addPlot(rtffile,plot.fun=print,width=6,height=6,res=600, Grp2P)
done(rtffile)
}
AlmacenGen2<-function(GrpP,Grp2P=GrpP,DataPas, PathDesignP, NmBasP,Typ=1){
NmFAl<-paste0(PathDesignP,NmBasP)
if (!dir.exists(NmFAl)) {dir.create(NmFAl)}
NmFAl<-paste0(NmFAl,"/")
pdf(paste0(NmFAl,NmBasP,".pdf"),family = "ArialMT")
plot(GrpP)
dev.off()
pdf(paste0(NmFAl,NmBasP,"_Asterisk.pdf"),family = "ArialMT")
plot(Grp2P)
dev.off()
png(paste0(NmFAl,NmBasP,".png"),width = 1200, height = 1000,family = "ArialMT")
plot(GrpP)
dev.off()
png(paste0(NmFAl,NmBasP,"_Asterisk.png"),width = 1200, height = 1000,family = "ArialMT")
plot(Grp2P)
dev.off()
rtffile <- RTF(paste0(NmFAl,NmBasP,"AllStats.doc"))
if (length(DataPas)<2 & Typ==1){
write.csv2(as.data.table(DataPas[[1]]),paste0(NmFAl,NmBasP,"ResStat",1,"_",names(DataPas)[1],".csv"))
addText(rtffile,paste0("Overall_",names(DataPas)[1]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[1]]));
addNewLine(rtffile)
}
if (length(DataPas)>2 & Typ==2){
for (i in 1:6) {
write.csv2(as.data.table(DataPas[[i]]),paste0(NmFAl,NmBasP,"ResStat",i,"_",names(DataPas)[i],".csv"))
addText(rtffile,paste0("Overall_",names(DataPas)[i]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[i]]));
addNewLine(rtffile)
}
}
cont<-6
if (length(DataPas)>2 & Typ==1){
for (i in 3:length(DataPas)) {
write.csv2(as.data.table(DataPas[[i]]),paste0(NmFAl,NmBasP,"ResStat",i,"_",names(DataPas)[i],".csv"))
addText(rtffile,paste0("Overall_",names(DataPas)[i]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[i]]));
addNewLine(rtffile)
}
}
if (length(DataPas)>2 & Typ==2){
for (j in 1:length(DataPas[[7]])) {
for (k in 1:length(DataPas[[7]][[j]])) {
cont<-cont+1
write.csv2(as.data.table(DataPas[[7]][[j]][[k]]),paste0(NmFAl,NmBasP,"ResStat",cont,"_Cond",j,
names(DataPas[[7]][[j]])[k],".csv"))
addText(rtffile,paste0("Simple Effect A*B on Time_","_Cond",j,names(DataPas[[7]][[j]])[k]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[7]][[j]][[k]]));
addNewLine(rtffile)
}
}
}
addPlot(rtffile,plot.fun=print,width=6,height=6,res=600, GrpP)
addNewLine(rtffile)
addPlot(rtffile,plot.fun=print,width=6,height=6,res=600, Grp2P)
done(rtffile)
}
AlmacenGen3<-function(GrpP,Grp2P=GrpP,DataPas, PathDesignP, NmBasP,Typ=1){
NmFAl<-paste0(PathDesignP,NmBasP)
if (!dir.exists(NmFAl)) {dir.create(NmFAl)}
NmFAl<-paste0(NmFAl,"/")
rtffile <- RTF(paste0(NmFAl,NmBasP,"AllStats.doc"))
if (length(DataPas)<2 & Typ==1){
write.csv2(as.data.table(DataPas[[1]]),paste0(NmFAl,NmBasP,"ResStat",1,"_",names(DataPas)[1],".csv"))
addText(rtffile,paste0("Overall_",names(DataPas)[1]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[1]]));
addNewLine(rtffile)
}
if (length(DataPas)>2 & Typ==2){
for (i in 1:6) {
write.csv2(as.data.table(DataPas[[i]]),paste0(NmFAl,NmBasP,"ResStat",i,"_",names(DataPas)[i],".csv"))
addText(rtffile,paste0("Overall_",names(DataPas)[i]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[i]]));
addNewLine(rtffile)
}
}
cont<-6
if (length(DataPas)>2 & Typ==1){
for (i in 3:length(DataPas)) {
write.csv2(as.data.table(DataPas[[i]]),paste0(NmFAl,NmBasP,"ResStat",i,"_",names(DataPas)[i],".csv"))
addText(rtffile,paste0("Overall_",names(DataPas)[i]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[i]]));
addNewLine(rtffile)
}
}
if (length(DataPas)>2 & Typ==2){
for (j in 1:length(DataPas[[7]])) {
for (k in 1:length(DataPas[[7]][[j]])) {
cont<-cont+1
write.csv2(as.data.table(DataPas[[7]][[j]][[k]]),paste0(NmFAl,NmBasP,"ResStat",cont,"_Cond",j,
names(DataPas[[7]][[j]])[k],".csv"))
addText(rtffile,paste0("Simple Effect A*B on Time_","_Cond",j,names(DataPas[[7]][[j]])[k]))
addNewLine(rtffile)
addTable(rtffile, as.data.table(DataPas[[7]][[j]][[k]]));
addNewLine(rtffile)
}
}
}
done(rtffile)
}
Kbl3<-function(ResPas,lbl) {
ResPas %>%
kbl(caption = lbl,digits=4,escape = F, align = "c") %>%
kable_paper("hover", bootstrap_options = c("striped", "hover", "condensed", "responsive"),full_width = F,font_size = 10)
} # Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResGen[[1]], "Omnibus AOV. Design 2x2");cat("\n")
Kbl3(ResGen[[2]], "Simple Effects Age-Sleep. Design 2x2")
Kbl3(ResGen[[3]], "Extense Simple Effects Age-Sleep. Design 2x2") # Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResGen[[1]], "Omnibus AOV. Design 2x(5xS)");cat("\n")
Kbl3(ResGen[[2]], "Simple Effects Age-Time. Design 2x(5xS)")
Kbl3(ResGen[[3]], "Main Effects of Time. Design 2x(5xS)") # Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
GrpO
plot(Grp3)
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResPas = ResGen[[1]], lbl = "Omnibus AOV. Design 2x2x(4xS)");cat("\n")
Kbl3(ResGen[[2]], "Interaction Age-Sleep. Design 2x2x(4xS)")
Kbl3(ResGen[[3]], "Interaction Age-Time. Design 2x2x(4xS)")
Kbl3(ResGen[[4]], "Interaction Sleep-Time. Design 2x2x(4xS)")
Kbl3(ResGen[[5]], "Main Effect Time. Design 2x2x(4xS)")
Kbl3(ResGen[[6]], "Simple Effect Time each Age-Sleep condition. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[1]][[1]], "Simple Effect Age-Sleep on Time=1 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[1]][[2]], "Simple Effect Age-Sleep on Time=1 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[1]][[3]], "Simple Effect Age-Sleep on Time=1 Extense Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[2]][[1]], "Simple Effect Age-Sleep on Time=2 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[2]][[2]], "Simple Effect Age-Sleep on Time=2 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[2]][[3]], "Simple Effect Age-Sleep on Time=2 Extense Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[3]][[1]], "Simple Effect Age-Sleep on Time=3 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[3]][[2]], "Simple Effect Age-Sleep on Time=3 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[3]][[3]], "Simple Effect Age-Sleep on Time=3 Extense Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[4]][[1]], "Simple Effect Age-Sleep on Time=4 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[4]][[2]], "Simple Effect Age-Sleep on Time=4 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[4]][[3]], "Simple Effect Age-Sleep on Time=4 Extense Simple Effects. Design 2x2x(4xS)") # Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
GrpO
plot(Grp3)
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResPas = ResGen[[1]], lbl = "Omnibus AOV. Design 2x2x(5xS)");cat("\n")
Kbl3(ResGen[[2]], "Interaction Age-Sleep. Design 2x2x(5xS)")
Kbl3(ResGen[[3]], "Interaction Age-Time. Design 2x2x(5xS)")
Kbl3(ResGen[[4]], "Interaction Sleep-Time. Design 2x2x(5xS)")
Kbl3(ResGen[[5]], "Main Effect Time. Design 2x2x(5xS)")
Kbl3(ResGen[[6]], "Simple Effect Time each Age-Sleep condition. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[1]], "Simple Effect Age-Sleep on Time=1 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[2]], "Simple Effect Age-Sleep on Time=1 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[3]], "Simple Effect Age-Sleep on Time=1 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[1]], "Simple Effect Age-Sleep on Time=2 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[2]], "Simple Effect Age-Sleep on Time=2 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[3]], "Simple Effect Age-Sleep on Time=2 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[1]], "Simple Effect Age-Sleep on Time=3 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[2]], "Simple Effect Age-Sleep on Time=3 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[3]], "Simple Effect Age-Sleep on Time=3 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[1]], "Simple Effect Age-Sleep on Time=4 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[2]], "Simple Effect Age-Sleep on Time=4 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[3]], "Simple Effect Age-Sleep on Time=4 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[1]], "Simple Effect Age-Sleep on Time=5 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[2]], "Simple Effect Age-Sleep on Time=5 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[3]], "Simple Effect Age-Sleep on Time=5 Extense Simple Effects. Design 2x2x(5xS)") # Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResGen[[1]], "Omnibus AOV Design 2x(4xS)");cat("\n")
Kbl3(ResGen[[2]], "Simple Effects Age-Time Design 2x(4xS)")
Kbl3(ResGen[[3]], "Main Effects Time Design 2x(4xS)") # Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
plot(Grp3)
GrpO
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResPas = ResGen[[1]], lbl = "Omnibus AOV. Design 2x2x(2xS)");cat("\n")
Kbl3(ResGen[[2]], "Interaction Age-Sleep. Design 2x2x(2xS)")
Kbl3(ResGen[[3]], "Interaction Age-Time. Design 2x2x(2xS)")
Kbl3(ResGen[[4]], "Interaction Sleep-Time. Design 2x2x(2xS)")
Kbl3(ResGen[[5]], "Main Effect Time. Design 2x2x(2xS)")
Kbl3(ResGen[[6]], "Simple Effect Time each Age-Sleep condition. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[1]][[1]], "Simple Effect Age-Sleep on Time=1 Omnibus AOV. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[1]][[2]], "Simple Effect Age-Sleep on Time=1 Simple Effects. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[1]][[3]], "Simple Effect Age-Sleep on Time=1 Extense Simple Effects. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[2]][[1]], "Simple Effect Age-Sleep on Time=2 Omnibus AOV. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[2]][[2]], "Simple Effect Age-Sleep on Time=2 Simple Effects. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[2]][[3]], "Simple Effect Age-Sleep on Time=2 Extense Simple Effects. Design 2x2x(2xS)")Figure 1. Object place recognition (OPR) behavioral performance. A) Schematic of behavioral design. B) Percent change in preference for displaced object [number of animals (n): young control (YC):n=16, young SD (YSD): n=15, old control (OC): n=13, old SD (OSD): n=15]. C) Percent change in preference for the unmoved objects. D) Total time of object exploration during training and testing in seconds (s). E) Percent change in preference for displaced object excluding trial 1. F) Percent change in preference for displaced object in young (n=7) and old (n=7) mice receiving delayed SD, 5 hr after training (YSD: n=6, OSD: n=7). G) Levels of plasma corticosterone in control (young: n=5; old: n=5) and SD (young: n=5; old: n=6) mice. In all Figures data are graphed using Box Plots according to robust statistics based on the median. The inner line corresponds to the median, the lower box represents the first quartile, the upper box the third quartile, and the extending lines, known as whiskers, represent the minimum and maximum, showing the extent of variability. The diamond represents the trimmed mean used for analysis, which was set at 0.2, according to robust statistics recommendations (Wilcox, 2012) for all age groups and sleep conditions. T1-T3: training trials. Asterisks (*) represent significance using alpha=0.05. Statistical details in Supplemental Statistical Table corresponding to Figure 1.
NmBas="Fig1B OPR"
ResGen<-NA
rrt<-ExData.2(nmF = paste0(PathDesign,"OPR.csv"),Vars = c(1:3))
DatDT<-rrt$DT
ArP<-rrt$Arp
#Graphs
Grp<- Grph.2(DatDT,"OPR",LblsP =c("Preference for Displaced Object", "","% Change in Object Preference"),c(-40,50),T)
Grp2<- Grp + geom_signif(annotation="*",
y_position=50, xmin=1 , xmax=2,
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10) +
geom_signif(annotation="*",
y_position=40, xmin=3 , xmax=4,
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10)+
geom_signif(annotation="*",
y_position=35, xmin=1 , xmax=3,
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10)+
geom_signif(annotation="*",
y_position=45, xmin=2 , xmax=4,
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10)
# AOV & Simple Effects
names(rrt$DT)[3]<-"DepV"
ResGen<-AOVBwF(2,2,DatPas = rrt,nBMM = 10000)
AlmacenGen(Grp,Grp2,ResGen,PathDesign,NmBas,Typ=1)
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResGen[[1]], "Omnibus AOV. Design 2x2");cat("\n")
Kbl3(ResGen[[2]], "Simple Effects Age-Sleep. Design 2x2")
Kbl3(ResGen[[3]], "Extense Simple Effects Age-Sleep. Design 2x2")[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.4007
2: B.p.value 0.4691
3: AB.p.value 0.0000 *
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.4009
2: B.p.value 0.4574
3: AB.p.value 0.0003 *
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas
1: Age 0.71 0.405 0.71 0.405 0.53 0.4688 0.4007 0.4009
2: Sleep 0.56 0.460 0.56 0.460 0.05 0.8283 0.4691 0.4574
3: Age*Sleep 14.86 0.001 -0.55 0.000 17.51 0.0001 0.0000 * 0.0003
SigMas EffSize
1: 0.10
2: 0.11
3: * 0.86
$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 17.74 16.07 3.39 0.0037 0.67 11.51 0.0078
2: Sleep on Old -11.97 15.10 -2.11 0.0516 0.70 4.47 0.0578
3: Age on Control 11.60 17.41 2.44 0.0256 0.56 5.96 0.0222
4: Age on SR -18.11 15.89 -2.98 0.0088 0.71 8.91 0.0089
EffSize.Boot
1: 0.67
2: 0.70
3: 0.52
4: 0.71
$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 17.74 16.07 3.39 0.0037 0.67 11.51 0.0067
2: Sleep on Old -11.97 15.10 -2.11 0.0516 0.69 4.47 0.0678
3: Age on Control 11.60 17.41 2.44 0.0256 0.53 5.96 0.0278
4: Age on SR -18.11 15.89 -2.98 0.0088 0.71 8.91 0.0133
5: YSR vs OC -6.14 15.58 -1.14 0.2711 0.25 1.30 0.2567
EffSize.Boot
1: 0.67
2: 0.70
3: 0.52
4: 0.71
5: 0.25
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.71 | 0.405 | 0.71 | 0.405 | 0.53 | 0.4688 | 0.4007 | 0.4009 | 0.10 | ||
| Sleep | 0.56 | 0.460 | 0.56 | 0.460 | 0.05 | 0.8283 | 0.4691 | 0.4574 | 0.11 | ||
| Age*Sleep | 14.86 | 0.001 | -0.55 | 0.000 | 17.51 | 0.0001 | 0.0000 |
|
0.0003 |
|
0.86 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 17.74 | 16.07 | 3.39 | 0.0037 | 0.67 | 11.51 | 0.0078 | 0.67 |
| Sleep on Old | -11.97 | 15.10 | -2.11 | 0.0516 | 0.70 | 4.47 | 0.0578 | 0.70 |
| Age on Control | 11.60 | 17.41 | 2.44 | 0.0256 | 0.56 | 5.96 | 0.0222 | 0.52 |
| Age on SR | -18.11 | 15.89 | -2.98 | 0.0088 | 0.71 | 8.91 | 0.0089 | 0.71 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 17.74 | 16.07 | 3.39 | 0.0037 | 0.67 | 11.51 | 0.0067 | 0.67 |
| Sleep on Old | -11.97 | 15.10 | -2.11 | 0.0516 | 0.69 | 4.47 | 0.0678 | 0.70 |
| Age on Control | 11.60 | 17.41 | 2.44 | 0.0256 | 0.53 | 5.96 | 0.0278 | 0.52 |
| Age on SR | -18.11 | 15.89 | -2.98 | 0.0088 | 0.71 | 8.91 | 0.0133 | 0.71 |
| YSR vs OC | -6.14 | 15.58 | -1.14 | 0.2711 | 0.25 | 1.30 | 0.2567 | 0.25 |
NmBas="Fig1D ObjectExploration"
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
ResGen<-NA
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"Exploration Final.csv"),Vars = c(1:7),vIntP =c(4:7),lvlCh = list("T1"="T1","T2"="T2","T3"="T3","Test"="Test" ))
DatDT<-rrt$DT
ArP<-rrt$Arp
ExtendDT<-rrt$ExtendDT
# Simple Effects:
DatEfS<-list()
for(is in 1:4) {
DatEfS[[is]]<-ExData.2(nmF = paste0(PathDesign,"Exploration Final.csv"),Vars = c(1:2,(3+is)))
names(DatEfS[[is]]$DT)[3]<-"DepV"
}
#Graphs
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Object Exploration", "","Total Object Exploration Time (s)"),ylmP =c(0,100),hLin = F,lvIp = 4,wMain = F)
levBp<-seq(0.7, 5, by=0.2)
Grp2<- Grp +
geom_signif(annotation=c("","","*"),
y_position=c(95,95,100),
xmin=c(levBp[1],levBp[1+5], mean(levBp[c(1,4)])),
xmax=c(levBp[4],levBp[4+5], mean(levBp[c(1+5,4+5)])),
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10)+
geom_signif(annotation=c("","","*"),
y_position=c(95,95,100),
xmin=c(levBp[1+10],levBp[1+15], mean(levBp[c(1+10,1+15)])),
xmax=c(levBp[4+10],levBp[4+15], mean(levBp[c(1+15,4+15)])),
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10)
#AOV
names(rrt$DT)[4:7]<-c("T1","T2","T3","T4")
ResGen<-AOVMx2(A=2,B=2,C=4,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
AlmacenGen2(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign,NmBasP = NmBas,Typ=2)
# Other Graphs
GrpO<-Grph.3.Otros(ExtendDT,LblsP =c("Object Exploration", "D","Total Object Exploration Time (s)"))
ExtendDTCol<-copy(ExtendDT)
ExtendDTCol$Moment<-"All"
ExtendDTCol<-data.table(rbind(ExtendDT,ExtendDTCol))
Grp3<-Grph.3(DatP = ExtendDTCol,"OPR",LblsP =c("Object Exploration", "D","Total Object Exploration Time (s)"),ylmP =c(0,100),hLin = F,lvIp = 5,wMain = T)
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
GrpO
dev.off()
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
GrpO
plot(Grp3)
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResPas = ResGen[[1]], lbl = "Omnibus AOV. Design 2x2x(4xS)");cat("\n")
Kbl3(ResGen[[2]], "Interaction Age-Sleep. Design 2x2x(4xS)")
Kbl3(ResGen[[3]], "Interaction Age-Time. Design 2x2x(4xS)")
Kbl3(ResGen[[4]], "Interaction Sleep-Time. Design 2x2x(4xS)")
Kbl3(ResGen[[5]], "Main Effect Time. Design 2x2x(4xS)")
Kbl3(ResGen[[6]], "Simple Effect Time each Age-Sleep condition. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[1]][[1]], "Simple Effect Age-Sleep on Time=1 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[1]][[2]], "Simple Effect Age-Sleep on Time=1 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[1]][[3]], "Simple Effect Age-Sleep on Time=1 Extense Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[2]][[1]], "Simple Effect Age-Sleep on Time=2 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[2]][[2]], "Simple Effect Age-Sleep on Time=2 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[2]][[3]], "Simple Effect Age-Sleep on Time=2 Extense Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[3]][[1]], "Simple Effect Age-Sleep on Time=3 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[3]][[2]], "Simple Effect Age-Sleep on Time=3 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[3]][[3]], "Simple Effect Age-Sleep on Time=3 Extense Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[4]][[1]], "Simple Effect Age-Sleep on Time=4 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[4]][[2]], "Simple Effect Age-Sleep on Time=4 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[4]][[3]], "Simple Effect Age-Sleep on Time=4 Extense Simple Effects. Design 2x2x(4xS)") Eff p.V1 p.Sig
1: p.value.A 0.7730
2: p.value.B 0.7813
3: p.value.C 0.0000 *
4: p.value.AB 0.5826
5: p.value.AC 0.5109
6: p.value.BC 0.9750
7: p.value.ABC 0.7613
Eff p.V1 p.Sig
1: p.value.A 0.7227
2: p.value.B 0.7892
3: p.value.C 0.0000 *
4: p.value.AB 0.3718
5: p.value.AC 0.5708
6: p.value.BC 0.9719
7: p.value.ABC 0.8117
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
quartz_off_screen
2
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
$AOV
Names Q p pBoot Sig pBootMas Sig2
1: Age 0.12 0.7256 0.7730 0.7227
2: Sleep 0.07 0.7904 0.7813 0.7892
3: Time 4.08 0.0068 0.0000 * 0.0000 *
4: Age*Sleep 0.31 0.5771 0.5826 0.3718
5: Age*Time 0.20 0.8986 0.5109 0.5708
6: Sleep*Time 0.02 0.9952 0.9750 0.9719
7: Age*Sleep*Time 0.09 0.9641 0.7613 0.8117
$InterAB
Contr psihat df test p.value EfSize.V1
1: Sleep on Young -6.17 50.73 -0.35 0.7290 0.03
2: Sleep on Old 17.41 52.36 0.88 0.3819 0.12
3: Age on Control -4.37 50.20 -0.25 0.8066 0.06
4: Age on SR 19.21 52.65 0.98 0.3340 0.13
$InterAC
Contr psihat df test p.value EfSize.V1
1: Age on M1 17.34 29.38 1.12 0.2701 0.20
2: Age on M2 -5.97 25.70 -0.41 0.6833 0.07
3: Age on M3 0.30 26.44 0.03 0.9772 0.04
4: Age on M4 3.18 28.58 0.26 0.7959 0.08
5: M1-M2 on Young 45.01 NA 3.14 0.0138 0.59
6: M1-M2 on Old 18.74 NA 2.37 0.0451 0.28
7: M2-M3 on Young 9.03 NA 0.88 0.4056 0.13
8: M2-M3 on Old 12.36 NA 1.73 0.1215 0.21
9: M3-M4 on Young -15.67 NA -2.24 0.0551 0.25
10: M3-M4 on Old -9.47 NA -1.06 0.3219 0.18
$InterBC
Contr psihat df test p.value EfSize.V1
1: Sleep on M1 0.35 29.38 0.02 0.9822 0.01
2: Sleep on M2 7.08 25.70 0.49 0.6291 0.07
3: Sleep on M3 1.41 26.44 0.14 0.8933 0.04
4: Sleep on M4 2.41 28.58 0.20 0.8444 0.07
5: M1-M2 on Control 32.93 NA 2.12 0.0671 0.46
6: M1-M2 on SR 26.55 NA 2.24 0.0553 0.46
7: M2-M3 on Control 10.67 NA 1.89 0.0956 0.19
8: M2-M3 on SR 14.02 NA 1.96 0.0859 0.13
9: M3-M4 on Control -9.89 NA -1.65 0.1371 0.26
10: M3-M4 on SR -10.96 NA -1.32 0.2226 0.19
$DetallMainC
Contr psihat test p.value Psihat2 p.value2 EfSize.V1
1: M1-M2 65.47 3.82 0.0051 67.19 0.000 0.46
2: M2-M3 28.35 2.17 0.0618 20.75 0.040 0.15
3: M3-M4 -25.41 -1.75 0.1180 -23.71 0.032 0.23
$DetallTrialCadaCondAB
Contr psihat df test p.value Psihat2 p.value2 dif.yuen df.yuen
1: M1-M2 on Y_C 18.61 NA 1.79 0.1106 21.02 0.000 21.02 10
2: M1-M2 on Y_SR 17.51 NA 2.03 0.0768 24.23 0.000 24.23 8
3: M1-M2 on O_C 8.49 NA 1.19 0.2682 9.21 0.272 9.21 8
4: M1-M2 on O_SR 9.79 NA 1.98 0.0834 12.73 0.020 12.73 8
5: M2-M3 on Y_C 6.66 NA 1.14 0.2878 3.85 0.344 3.85 10
6: M2-M3 on Y_SR 4.33 NA 0.90 0.3965 3.39 0.532 3.39 8
7: M2-M3 on O_C 4.20 NA 1.51 0.1697 9.36 0.068 9.36 8
8: M2-M3 on O_SR 7.51 NA 1.30 0.2311 4.15 0.332 4.15 8
9: M3-M4 on Y_C -13.59 NA -1.76 0.1167 -8.77 0.128 -8.77 10
10: M3-M4 on Y_SR -0.82 NA -0.14 0.8955 -4.52 0.444 -4.52 8
11: M3-M4 on O_C 1.33 NA 0.28 0.7837 -3.59 0.756 -3.59 8
12: M3-M4 on O_SR -8.77 NA -1.50 0.1708 -6.83 0.104 -6.83 8
test.yuen EffSize.yuen pvaluet.yuen
1: 2.82 0.59 0.0182
2: 2.85 0.57 0.0213
3: 1.05 0.22 0.3233
4: 1.95 0.32 0.0876
5: 0.86 0.13 0.4086
6: 0.67 0.10 0.5247
7: 1.52 0.26 0.1662
8: 0.65 0.14 0.5344
9: -1.46 0.34 0.1744
10: -0.84 0.13 0.4250
11: -0.75 0.12 0.4770
12: -1.45 0.30 0.1850
$DetallSimple
$DetallSimple[[1]]
$DetallSimple[[1]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 1.26 0.270 1.26 0.270 0.96 0.3307 0.2821 0.268
2: Sleep 0.00 0.983 0.00 0.983 0.02 0.8820 0.9800 0.987
3: Age*Sleep 0.41 0.526 0.07 0.650 0.18 0.6738 0.5910 0.543
EffSize
1: 0.20
2: 0.01
3: 0.12
$DetallSimple[[1]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -4.78 14.18 -0.43 0.6745 0.12 0.18 0.6722
2: Sleep on Old 5.13 15.41 0.48 0.6374 0.12 0.23 0.6211
3: Age on Control 3.72 15.42 0.36 0.7218 0.10 0.13 0.7222
4: Age on SR 13.62 14.58 1.18 0.2563 0.31 1.40 0.2767
EffSize.Boot
1: 0.14
2: 0.10
3: 0.10
4: 0.31
$DetallSimple[[1]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -4.78 14.18 -0.43 0.6745 0.12 0.18 0.6411
2: Sleep on Old 5.13 15.41 0.48 0.6374 0.12 0.23 0.6367
3: Age on Control 3.72 15.42 0.36 0.7218 0.10 0.13 0.7378
4: Age on SR 13.62 14.58 1.18 0.2563 0.31 1.40 0.2678
5: YSR vs OC 8.49 15.76 0.68 0.5052 0.17 0.47 0.5122
EffSize.Boot
1: 0.12
2: 0.11
3: 0.08
4: 0.31
5: 0.18
$DetallSimple[[2]]
$DetallSimple[[2]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.17 0.684 0.17 0.684 0.20 0.6528 0.6912 0.686
2: Sleep 0.24 0.630 0.24 0.630 0.10 0.7571 0.6194 0.635
3: Age*Sleep 0.50 0.487 0.07 0.640 0.34 0.5641 0.5576 0.483
EffSize
1: 0.07
2: 0.07
3: 0.19
$DetallSimple[[2]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -1.57 17.67 -0.22 0.8297 0.06 0.05 0.8156
2: Sleep on Old 8.65 15.98 0.69 0.5009 0.15 0.47 0.4822
3: Age on Control -8.10 12.73 -0.78 0.4486 0.22 0.61 0.4200
4: Age on SR 2.12 12.99 0.21 0.8370 0.06 0.04 0.8311
EffSize.Boot
1: 0.06
2: 0.21
3: 0.18
4: 0.06
$DetallSimple[[2]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -1.57 17.67 -0.22 0.8297 0.06 0.05 0.8033
2: Sleep on Old 8.65 15.98 0.69 0.5009 0.16 0.47 0.5133
3: Age on Control -8.10 12.73 -0.78 0.4486 0.20 0.61 0.4411
4: Age on SR 2.12 12.99 0.21 0.8370 0.06 0.04 0.8344
5: YSR vs OC -6.53 12.69 -0.63 0.5421 0.17 0.39 0.5322
EffSize.Boot
1: 0.06
2: 0.19
3: 0.21
4: 0.06
5: 0.16
$DetallSimple[[3]]
$DetallSimple[[3]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.00 0.978 0.00 0.978 0.00 0.9749 0.9766 0.973
2: Sleep 0.02 0.894 0.02 0.894 0.01 0.9146 0.9048 0.895
3: Age*Sleep 0.28 0.603 0.09 0.560 0.38 0.5418 0.8164 0.609
EffSize
1: 0.05
2: 0.04
3: 0.16
$DetallSimple[[3]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -2.03 14.48 -0.24 0.8129 0.08 0.06 0.8044
2: Sleep on Old 3.44 14.82 0.57 0.5795 0.13 0.32 0.5478
3: Age on Control -2.59 17.62 -0.38 0.7067 0.11 0.15 0.7322
4: Age on SR 2.89 12.02 0.37 0.7209 0.10 0.13 0.7033
EffSize.Boot
1: 0.08
2: 0.15
3: 0.10
4: 0.10
$DetallSimple[[3]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -2.03 14.48 -0.24 0.8129 0.08 0.06 0.8033
2: Sleep on Old 3.44 14.82 0.57 0.5795 0.14 0.32 0.6078
3: Age on Control -2.59 17.62 -0.38 0.7067 0.09 0.15 0.7122
4: Age on SR 2.89 12.02 0.37 0.7209 0.10 0.13 0.7111
5: YSR vs OC -0.55 14.26 -0.06 0.9491 0.07 0.00 0.9478
EffSize.Boot
1: 0.08
2: 0.15
3: 0.10
4: 0.10
5: 0.07
$DetallSimple[[4]]
$DetallSimple[[4]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.07 0.796 0.07 0.796 0.13 0.7195 0.7880 0.807
2: Sleep 0.04 0.845 0.04 0.845 0.01 0.9207 0.8331 0.857
3: Age*Sleep 0.03 0.870 -0.09 0.570 0.36 0.5536 0.9549 0.877
EffSize
1: 0.09
2: 0.07
3: 0.13
$DetallSimple[[4]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 2.21 12.61 0.27 0.7904 0.07 0.07 0.7933
2: Sleep on Old 0.20 15.98 0.02 0.9828 0.05 0.00 0.9867
3: Age on Control 2.60 13.45 0.34 0.7372 0.12 0.12 0.7322
4: Age on SR 0.58 15.75 0.06 0.9521 0.02 0.00 0.9467
EffSize.Boot
1: 0.08
2: 0.05
3: 0.12
4: 0.02
$DetallSimple[[4]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 2.21 12.61 0.27 0.7904 0.07 0.07 0.7678
2: Sleep on Old 0.20 15.98 0.02 0.9828 0.05 0.00 0.9856
3: Age on Control 2.60 13.45 0.34 0.7372 0.12 0.12 0.7078
4: Age on SR 0.58 15.75 0.06 0.9521 0.02 0.00 0.9467
5: YSR vs OC 0.38 15.85 0.04 0.9688 0.05 0.00 0.9667
EffSize.Boot
1: 0.07
2: 0.06
3: 0.14
4: 0.02
5: 0.06
| Names | Q | p | pBoot | Sig | pBootMas | Sig2 |
|---|---|---|---|---|---|---|
| Age | 0.12 | 0.7256 | 0.7730 | 0.7227 | ||
| Sleep | 0.07 | 0.7904 | 0.7813 | 0.7892 | ||
| Time | 4.08 | 0.0068 | 0.0000 |
|
0.0000 |
|
| Age*Sleep | 0.31 | 0.5771 | 0.5826 | 0.3718 | ||
| Age*Time | 0.20 | 0.8986 | 0.5109 | 0.5708 | ||
| Sleep*Time | 0.02 | 0.9952 | 0.9750 | 0.9719 | ||
| AgeSleepTime | 0.09 | 0.9641 | 0.7613 | 0.8117 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on Young | -6.17 | 50.73 | -0.35 | 0.7290 | 0.03 |
| Sleep on Old | 17.41 | 52.36 | 0.88 | 0.3819 | 0.12 |
| Age on Control | -4.37 | 50.20 | -0.25 | 0.8066 | 0.06 |
| Age on SR | 19.21 | 52.65 | 0.98 | 0.3340 | 0.13 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Age on M1 | 17.34 | 29.38 | 1.12 | 0.2701 | 0.20 |
| Age on M2 | -5.97 | 25.70 | -0.41 | 0.6833 | 0.07 |
| Age on M3 | 0.30 | 26.44 | 0.03 | 0.9772 | 0.04 |
| Age on M4 | 3.18 | 28.58 | 0.26 | 0.7959 | 0.08 |
| M1-M2 on Young | 45.01 | NA | 3.14 | 0.0138 | 0.59 |
| M1-M2 on Old | 18.74 | NA | 2.37 | 0.0451 | 0.28 |
| M2-M3 on Young | 9.03 | NA | 0.88 | 0.4056 | 0.13 |
| M2-M3 on Old | 12.36 | NA | 1.73 | 0.1215 | 0.21 |
| M3-M4 on Young | -15.67 | NA | -2.24 | 0.0551 | 0.25 |
| M3-M4 on Old | -9.47 | NA | -1.06 | 0.3219 | 0.18 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on M1 | 0.35 | 29.38 | 0.02 | 0.9822 | 0.01 |
| Sleep on M2 | 7.08 | 25.70 | 0.49 | 0.6291 | 0.07 |
| Sleep on M3 | 1.41 | 26.44 | 0.14 | 0.8933 | 0.04 |
| Sleep on M4 | 2.41 | 28.58 | 0.20 | 0.8444 | 0.07 |
| M1-M2 on Control | 32.93 | NA | 2.12 | 0.0671 | 0.46 |
| M1-M2 on SR | 26.55 | NA | 2.24 | 0.0553 | 0.46 |
| M2-M3 on Control | 10.67 | NA | 1.89 | 0.0956 | 0.19 |
| M2-M3 on SR | 14.02 | NA | 1.96 | 0.0859 | 0.13 |
| M3-M4 on Control | -9.89 | NA | -1.65 | 0.1371 | 0.26 |
| M3-M4 on SR | -10.96 | NA | -1.32 | 0.2226 | 0.19 |
| Contr | psihat | test | p.value | Psihat2 | p.value2 | EfSize.V1 |
|---|---|---|---|---|---|---|
| M1-M2 | 65.47 | 3.82 | 0.0051 | 67.19 | 0.000 | 0.46 |
| M2-M3 | 28.35 | 2.17 | 0.0618 | 20.75 | 0.040 | 0.15 |
| M3-M4 | -25.41 | -1.75 | 0.1180 | -23.71 | 0.032 | 0.23 |
| Contr | psihat | df | test | p.value | Psihat2 | p.value2 | dif.yuen | df.yuen | test.yuen | EffSize.yuen | pvaluet.yuen |
|---|---|---|---|---|---|---|---|---|---|---|---|
| M1-M2 on Y_C | 18.61 | NA | 1.79 | 0.1106 | 21.02 | 0.000 | 21.02 | 10 | 2.82 | 0.59 | 0.0182 |
| M1-M2 on Y_SR | 17.51 | NA | 2.03 | 0.0768 | 24.23 | 0.000 | 24.23 | 8 | 2.85 | 0.57 | 0.0213 |
| M1-M2 on O_C | 8.49 | NA | 1.19 | 0.2682 | 9.21 | 0.272 | 9.21 | 8 | 1.05 | 0.22 | 0.3233 |
| M1-M2 on O_SR | 9.79 | NA | 1.98 | 0.0834 | 12.73 | 0.020 | 12.73 | 8 | 1.95 | 0.32 | 0.0876 |
| M2-M3 on Y_C | 6.66 | NA | 1.14 | 0.2878 | 3.85 | 0.344 | 3.85 | 10 | 0.86 | 0.13 | 0.4086 |
| M2-M3 on Y_SR | 4.33 | NA | 0.90 | 0.3965 | 3.39 | 0.532 | 3.39 | 8 | 0.67 | 0.10 | 0.5247 |
| M2-M3 on O_C | 4.20 | NA | 1.51 | 0.1697 | 9.36 | 0.068 | 9.36 | 8 | 1.52 | 0.26 | 0.1662 |
| M2-M3 on O_SR | 7.51 | NA | 1.30 | 0.2311 | 4.15 | 0.332 | 4.15 | 8 | 0.65 | 0.14 | 0.5344 |
| M3-M4 on Y_C | -13.59 | NA | -1.76 | 0.1167 | -8.77 | 0.128 | -8.77 | 10 | -1.46 | 0.34 | 0.1744 |
| M3-M4 on Y_SR | -0.82 | NA | -0.14 | 0.8955 | -4.52 | 0.444 | -4.52 | 8 | -0.84 | 0.13 | 0.4250 |
| M3-M4 on O_C | 1.33 | NA | 0.28 | 0.7837 | -3.59 | 0.756 | -3.59 | 8 | -0.75 | 0.12 | 0.4770 |
| M3-M4 on O_SR | -8.77 | NA | -1.50 | 0.1708 | -6.83 | 0.104 | -6.83 | 8 | -1.45 | 0.30 | 0.1850 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 1.26 | 0.270 | 1.26 | 0.270 | 0.96 | 0.3307 | 0.2821 | 0.268 | 0.20 | ||
| Sleep | 0.00 | 0.983 | 0.00 | 0.983 | 0.02 | 0.8820 | 0.9800 | 0.987 | 0.01 | ||
| Age*Sleep | 0.41 | 0.526 | 0.07 | 0.650 | 0.18 | 0.6738 | 0.5910 | 0.543 | 0.12 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -4.78 | 14.18 | -0.43 | 0.6745 | 0.12 | 0.18 | 0.6722 | 0.14 |
| Sleep on Old | 5.13 | 15.41 | 0.48 | 0.6374 | 0.12 | 0.23 | 0.6211 | 0.10 |
| Age on Control | 3.72 | 15.42 | 0.36 | 0.7218 | 0.10 | 0.13 | 0.7222 | 0.10 |
| Age on SR | 13.62 | 14.58 | 1.18 | 0.2563 | 0.31 | 1.40 | 0.2767 | 0.31 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -4.78 | 14.18 | -0.43 | 0.6745 | 0.12 | 0.18 | 0.6411 | 0.12 |
| Sleep on Old | 5.13 | 15.41 | 0.48 | 0.6374 | 0.12 | 0.23 | 0.6367 | 0.11 |
| Age on Control | 3.72 | 15.42 | 0.36 | 0.7218 | 0.10 | 0.13 | 0.7378 | 0.08 |
| Age on SR | 13.62 | 14.58 | 1.18 | 0.2563 | 0.31 | 1.40 | 0.2678 | 0.31 |
| YSR vs OC | 8.49 | 15.76 | 0.68 | 0.5052 | 0.17 | 0.47 | 0.5122 | 0.18 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.17 | 0.684 | 0.17 | 0.684 | 0.20 | 0.6528 | 0.6912 | 0.686 | 0.07 | ||
| Sleep | 0.24 | 0.630 | 0.24 | 0.630 | 0.10 | 0.7571 | 0.6194 | 0.635 | 0.07 | ||
| Age*Sleep | 0.50 | 0.487 | 0.07 | 0.640 | 0.34 | 0.5641 | 0.5576 | 0.483 | 0.19 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -1.57 | 17.67 | -0.22 | 0.8297 | 0.06 | 0.05 | 0.8156 | 0.06 |
| Sleep on Old | 8.65 | 15.98 | 0.69 | 0.5009 | 0.15 | 0.47 | 0.4822 | 0.21 |
| Age on Control | -8.10 | 12.73 | -0.78 | 0.4486 | 0.22 | 0.61 | 0.4200 | 0.18 |
| Age on SR | 2.12 | 12.99 | 0.21 | 0.8370 | 0.06 | 0.04 | 0.8311 | 0.06 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -1.57 | 17.67 | -0.22 | 0.8297 | 0.06 | 0.05 | 0.8033 | 0.06 |
| Sleep on Old | 8.65 | 15.98 | 0.69 | 0.5009 | 0.16 | 0.47 | 0.5133 | 0.19 |
| Age on Control | -8.10 | 12.73 | -0.78 | 0.4486 | 0.20 | 0.61 | 0.4411 | 0.21 |
| Age on SR | 2.12 | 12.99 | 0.21 | 0.8370 | 0.06 | 0.04 | 0.8344 | 0.06 |
| YSR vs OC | -6.53 | 12.69 | -0.63 | 0.5421 | 0.17 | 0.39 | 0.5322 | 0.16 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.00 | 0.978 | 0.00 | 0.978 | 0.00 | 0.9749 | 0.9766 | 0.973 | 0.05 | ||
| Sleep | 0.02 | 0.894 | 0.02 | 0.894 | 0.01 | 0.9146 | 0.9048 | 0.895 | 0.04 | ||
| Age*Sleep | 0.28 | 0.603 | 0.09 | 0.560 | 0.38 | 0.5418 | 0.8164 | 0.609 | 0.16 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -2.03 | 14.48 | -0.24 | 0.8129 | 0.08 | 0.06 | 0.8044 | 0.08 |
| Sleep on Old | 3.44 | 14.82 | 0.57 | 0.5795 | 0.13 | 0.32 | 0.5478 | 0.15 |
| Age on Control | -2.59 | 17.62 | -0.38 | 0.7067 | 0.11 | 0.15 | 0.7322 | 0.10 |
| Age on SR | 2.89 | 12.02 | 0.37 | 0.7209 | 0.10 | 0.13 | 0.7033 | 0.10 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -2.03 | 14.48 | -0.24 | 0.8129 | 0.08 | 0.06 | 0.8033 | 0.08 |
| Sleep on Old | 3.44 | 14.82 | 0.57 | 0.5795 | 0.14 | 0.32 | 0.6078 | 0.15 |
| Age on Control | -2.59 | 17.62 | -0.38 | 0.7067 | 0.09 | 0.15 | 0.7122 | 0.10 |
| Age on SR | 2.89 | 12.02 | 0.37 | 0.7209 | 0.10 | 0.13 | 0.7111 | 0.10 |
| YSR vs OC | -0.55 | 14.26 | -0.06 | 0.9491 | 0.07 | 0.00 | 0.9478 | 0.07 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.07 | 0.796 | 0.07 | 0.796 | 0.13 | 0.7195 | 0.7880 | 0.807 | 0.09 | ||
| Sleep | 0.04 | 0.845 | 0.04 | 0.845 | 0.01 | 0.9207 | 0.8331 | 0.857 | 0.07 | ||
| Age*Sleep | 0.03 | 0.870 | -0.09 | 0.570 | 0.36 | 0.5536 | 0.9549 | 0.877 | 0.13 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 2.21 | 12.61 | 0.27 | 0.7904 | 0.07 | 0.07 | 0.7933 | 0.08 |
| Sleep on Old | 0.20 | 15.98 | 0.02 | 0.9828 | 0.05 | 0.00 | 0.9867 | 0.05 |
| Age on Control | 2.60 | 13.45 | 0.34 | 0.7372 | 0.12 | 0.12 | 0.7322 | 0.12 |
| Age on SR | 0.58 | 15.75 | 0.06 | 0.9521 | 0.02 | 0.00 | 0.9467 | 0.02 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 2.21 | 12.61 | 0.27 | 0.7904 | 0.07 | 0.07 | 0.7678 | 0.07 |
| Sleep on Old | 0.20 | 15.98 | 0.02 | 0.9828 | 0.05 | 0.00 | 0.9856 | 0.06 |
| Age on Control | 2.60 | 13.45 | 0.34 | 0.7372 | 0.12 | 0.12 | 0.7078 | 0.14 |
| Age on SR | 0.58 | 15.75 | 0.06 | 0.9521 | 0.02 | 0.00 | 0.9467 | 0.02 |
| YSR vs OC | 0.38 | 15.85 | 0.04 | 0.9688 | 0.05 | 0.00 | 0.9667 | 0.06 |
NmBas="Fig1F OPRDelayed"
DatDTFull <- data.table(read.table(paste0(PathDesign,"OPRDelayed.csv"), header=TRUE, sep=";",
na.strings="NA", dec=",",strip.white=TRUE))
DatDT<-DatDTFull
DatDT$Group<-factor(DatDT$Group);DatDT$Group<-relevel(DatDT$Group,"Young_DSR")
#Graphs
Grp<- Grph.1(DatDT,"OPRDelayed",LblsP =c("Preference for Displaced Object", "","% Change in Object Preference"),c(-10,15),T,GrpSel=c(2,4))
Grp2<- Grp + geom_signif(annotation="*",
y_position=15, xmin=1 , xmax=2,
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10)
YuenRes<-WRS2::yuen(OPRDelayed~Group,DatDT)
ResFn<-list()
ResFn$AOV<-data.table(with(YuenRes, cbind(diff=round(diff,2),df=round(df,2),test=round(test,2),EffSize=round(effsize,2),p=round(p.value,4))))
AlmacenGen(GrpP = Grp,Grp2P = Grp2,DataPas = ResFn,PathDesignP = PathDesign,NmBasP = NmBas,Typ = 1)
#Results
plot(Grp)
plot(Grp2)
ResFn$AOV
diff df test EffSize p
1: 11.96 6.88 4.85 0.88 0.0019
# Command selection. Copy the rest of the lines of code from the chunk of the reference figure and in the same order.
# Fig 1C Percent change in preference for the unmoved objects {Design 2x2}
# As Fig.1B
rrt<-ExData.2(nmF = paste0(PathDesign,"Preference.csv"),Vars = c(1:3))
Grp<- Grph.2(DatDT,"Preference",LblsP =c("Preference for Unmoved Objects", "","% Change in Object Preference"),c(-25,25),T)
ResGen<-AOVBwF(2,2,DatPas = rrt,nBMM = 10000)
# Fig 1E Percent change in preference for displaced object excluding trial 1 {Design 2x2}
# As Fig.1B
rrt<-ExData.2(nmF = paste0(PathDesign,"OPR.csv"),Vars = c(1:2,4))
Grp<- Grph.2(DatDT,"OPRSinT1",LblsP =c("Preference for Displaced Object", "","% Change in Object Preference"),c(-40,50),T)
ResGen<-AOVBwF(2,2,DatPas = rrt,nBMM = 10000)
# Fig 1G Levels of plasma corticosterone in control and SD mice {Design 2x2}
# As Fig.1B
rrt<-ExData.2(nmF = paste0(PathDesign,"Cortisol.csv"),Vars = c(1:4))
Grp<- Grph.2(DatDT,"cortisol",LblsP =c("Preference for Displaced Object", "","Corticosterone (ng/ml)"),c(0,200),F)
ResGen<-AOVBwF(2,2,DatPas = rrt,nBMM = 10000)Figure 2. Rate and global remapping across sessions and percentage of different cell types during OPR performance. A) OPR performance comparing tetrode, EEG/EMG and all implanted animals. B) Isolation distance showing absence of differences in spike cluster quality across conditions over time. C) Average rate remapping for all groups across trials. Young controls and old SD mice displayed higher rate remapping during the test trial in comparison to the last training trial (T3). Additionally, these groups also displayed more rate remapping than young SD mice during the test. D) Average global remapping (map similarity) for all groups across trials. Old animals displayed more remapping (i.e., instability) than young mice between the habituation and trial 1 and during testing. E-F) Percentage of context, object configuration, and unstable cells recorded in young (E) and old (F) mice. Young controls: 6 mice, 60 cells, range of cells per animal: 6-16, young SD: 4 mice, 50 cells, range of cells per animal: 8-18, old control: 5 mice, 36 cells, range of cells per animal: 5-13, old SD: 5 mice, 41 cells: range of cells per animal: 4-13. Hab: habituation, T1-T3: training trials. Asterisks (*) represent significance using alpha=0.05. Statistical details in Supplemental Statistical Table corresponding to Figure 2.
NmBas="Fig2A CompareTetrodeEEG"
NmFich="OPR.csv";
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
NmFich<-paste0(PathDesign,NmFich);
DatDTFull <- data.table(read.table(NmFich, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
DatDTFull$Age<-factor(DatDTFull$Age);DatDTFull$Age<-relevel(DatDTFull$Age,"Young")
DatDTFull$Sleep<-factor(DatDTFull$Sleep);levels(DatDTFull$Sleep) <- list("Control"="control", "SR"="restriction")
DatDTFull$Implant<-factor(DatDTFull$Implant);DatDTFull$Implant<-relevel(DatDTFull$Implant,"Tetrode")
setkey(DatDTFull,Age,Sleep,Implant)
ArP3w<-unlist(unlist(lapply(1:2, function (x) lapply(1:2, function(y) lapply(1:2, function(z) na.omit(DatDTFull[.(levels(DatDTFull$Age)[x],levels(DatDTFull$Sleep)[y],levels(DatDTFull$Implant)[z]),3,with=F][[1]])))),recursive = F),recursive = F)
ResRo<-list()
RsRb<-t3way(2,2,2,ArP3w)
ExRsRbp<-with(RsRb, round(c(A.p.value, B.p.value,C.p.value, AB.p.value, AC.p.value, BC.p.value, ABC.p.value),4))
ExRsRbQ<-with(RsRb, round(c(Qa, Qb,Qc, Qab, Qac, Qbc, Qabc),2))
ExFn<-data.table(ExRsRbQ,ExRsRbp)
names(ExFn)<-c("Q","p")
ExFnFn<-data.table(Names=c("Age","Sleep","Implant","Age*Sleep","Age*Implant","Sleep*Implant","Age*Sleep*Implant"),ExFn)
#write.csv2(ExFnFn,paste0(NmFAlL,NmBas,"Omn.csv"))
DatDTCop<-copy(DatDTFull)
names(DatDTCop)[3]<-"DepVar"
Grp<- Grph.3d(DatP = DatDTCop,"OPR",LblsP =c("Preference for Unmoved Objects", "","% Change in Object Preference"),ylmP =c(-40,50),hLin = T,lvIp = 2,wMain = F)
levBp<-seq(0.7, 4, by=0.2)
Grp2<- Grp +
geom_signif(annotation=c("","","*"),
y_position=c(33,34,35),
xmin=c(levBp[1],levBp[2], 0.1+mean(levBp[c(1)])),
xmax=c(levBp[1+5],levBp[2+5], mean(levBp[c(2,2+5)])),
tip_length = c(c(0.01, 0.01),c(0.01, 0.01),c(0.02, 0.01)),vjust=0.5,textsize=10) +
geom_signif(annotation=c("","","*"),
y_position=c(37,38,39),
xmin=c(levBp[3],levBp[4], 0.1+mean(levBp[c(3)])),
xmax=c(levBp[3+5],levBp[4+5], mean(levBp[c(4,4+5)])),
tip_length = c(c(0.01, 0.01),c(0.01, 0.01),c(0.02, 0.01)),vjust=0.5,textsize=10) +
geom_signif(annotation=c("","","*"),
y_position=c(41,42,43),
xmin=c(levBp[1],levBp[3], 0.1+mean(levBp[c(1)])),
xmax=c(levBp[1+5],levBp[3+5], mean(levBp[c(3,3+5)])),
tip_length = c(c(0.01, 0.01),c(0.01, 0.01),c(0.02, 0.01)),vjust=0.5,textsize=10) +
geom_signif(annotation=c("","","*"),
y_position=c(45,46,47),
xmin=c(levBp[2],levBp[4], 0.1+mean(levBp[c(2)])),
xmax=c(levBp[2+5],levBp[4+5], mean(levBp[c(4,4+5)])),
tip_length = c(c(0.01, 0.01),c(0.01, 0.01),c(0.02, 0.01)),vjust=0.5,textsize=10)
ExtendDTCol<-copy(DatDTCop)
ExtendDTCol$Implant<-"All"
ExtendDTCol<-data.table(rbind(DatDTCop,ExtendDTCol))
Grp3<- Grph.3c(DatP = ExtendDTCol,"OPR",LblsP =c("Preference for Unmoved Objects", "","% Change in Object Preference"),ylmP =c(-40,50),hLin = T,lvIp = 3,wMain = F)
ResFn<-list()
ResFn$AOV<-ExFnFn
AlmacenGen(GrpP = Grp,Grp2P = Grp2,DataPas = ResFn,PathDesignP = PathDesign,NmBasP = NmBas,Typ = 1)
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
dev.off()
#Results
plot(Grp)
plot(Grp2)
plot(Grp3)
ResFn
Kbl3(ResPas = ResFn[[1]], lbl = "Omnibus AOV. Design 2x2x2")quartz_off_screen
2
$AOV
Names Q p
1: Age 0.42 0.530
2: Sleep 0.03 0.860
3: Implant 0.27 0.609
4: Age*Sleep 17.53 0.001
5: Age*Implant 0.13 0.723
6: Sleep*Implant 2.06 0.168
7: Age*Sleep*Implant 0.82 0.378
| Names | Q | p |
|---|---|---|
| Age | 0.42 | 0.530 |
| Sleep | 0.03 | 0.860 |
| Implant | 0.27 | 0.609 |
| Age*Sleep | 17.53 | 0.001 |
| Age*Implant | 0.13 | 0.723 |
| Sleep*Implant | 2.06 | 0.168 |
| AgeSleepImplant | 0.82 | 0.378 |
NmBas="Fig2B IsolationDistance"
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
ResGen<-NA
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"ClusterQuality.csv"),Vars = c(1,5,6,7:11),vIntP =c(4:8),lvlCh = list("HAB"="id_s1", "T1"="id_s2","T2"="id_s3","T3"="id_s4","Test"="id_s5"))
DatDT<-rrt$DT
ArP<-rrt$Arp
ExtendDT<-rrt$ExtendDT
# For Simple Effects
DatEfS<-list()
for(is in 1:5) {
DatEfS[[is]]<-ExData.2(nmF = paste0(PathDesign,"ClusterQuality.csv"),Vars = c(5:6,(6+is)))
names(DatEfS[[is]]$DT)[3]<-"DepV"
}
#Graphs
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Cluster Quality", "","Isolation Distance"),ylmP =c(0,40),hLin = F,lvIp=5)
Grp2=Grp
#AOV
names(rrt$DT)[4:8]<-c("T1","T2","T3","T4","T5")
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
AlmacenGen2(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign,NmBasP = NmBas,Typ=2)
# Other Graphs
GrpO<-Grph.3.Otros(ExtendDT,LblsP =c("Cluster Quality", "H","Isolation Distance"))
ExtendDTCol<-copy(ExtendDT)
ExtendDTCol$Moment<-"All"
ExtendDTCol<-data.table(rbind(ExtendDT,ExtendDTCol))
Grp3<-Grph.3(DatP = ExtendDTCol,"OPR",LblsP =c("Cluster Quality", "H","Isolation Distance"),
ylmP =c(0,40),hLin = F,lvIp = 6,wMain = T)
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
GrpO
dev.off()
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
GrpO
plot(Grp3)
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResPas = ResGen[[1]], lbl = "Omnibus AOV. Design 2x2x(5xS)");cat("\n")
Kbl3(ResGen[[2]], "Interaction Age-Sleep. Design 2x2x(5xS)")
Kbl3(ResGen[[3]], "Interaction Age-Time. Design 2x2x(5xS)")
Kbl3(ResGen[[4]], "Interaction Sleep-Time. Design 2x2x(5xS)")
Kbl3(ResGen[[5]], "Main Effect Time. Design 2x2x(5xS)")
Kbl3(ResGen[[6]], "Simple Effect Time each Age-Sleep condition. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[1]], "Simple Effect Age-Sleep on Time=1 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[2]], "Simple Effect Age-Sleep on Time=1 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[3]], "Simple Effect Age-Sleep on Time=1 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[1]], "Simple Effect Age-Sleep on Time=2 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[2]], "Simple Effect Age-Sleep on Time=2 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[3]], "Simple Effect Age-Sleep on Time=2 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[1]], "Simple Effect Age-Sleep on Time=3 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[2]], "Simple Effect Age-Sleep on Time=3 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[3]], "Simple Effect Age-Sleep on Time=3 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[1]], "Simple Effect Age-Sleep on Time=4 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[2]], "Simple Effect Age-Sleep on Time=4 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[3]], "Simple Effect Age-Sleep on Time=4 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[1]], "Simple Effect Age-Sleep on Time=5 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[2]], "Simple Effect Age-Sleep on Time=5 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[3]], "Simple Effect Age-Sleep on Time=5 Extense Simple Effects. Design 2x2x(5xS)") Eff p.V1 p.Sig
1: p.value.A 0.7129
2: p.value.B 0.8948
3: p.value.C 0.2287
4: p.value.AB 0.7028
5: p.value.AC 0.4541
6: p.value.BC 0.6611
7: p.value.ABC 0.8865
Eff p.V1 p.Sig
1: p.value.A 0.7248
2: p.value.B 0.8844
3: p.value.C 0.3152
4: p.value.AB 0.8466
5: p.value.AC 0.5323
6: p.value.BC 0.7317
7: p.value.ABC 0.9004
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
quartz_off_screen
2
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
$AOV
Names Q p pBoot Sig pBootMas Sig2
1: Age 0.12 0.7267 0.7129 0.7248
2: Sleep 0.02 0.8851 0.8948 0.8844
3: Time 0.48 0.7476 0.2287 0.3152
4: Age*Sleep 0.14 0.7101 0.7028 0.8466
5: Age*Time 0.32 0.8647 0.4541 0.5323
6: Sleep*Time 0.20 0.9370 0.6611 0.7317
7: Age*Sleep*Time 0.11 0.9805 0.8865 0.9004
$InterAB
Contr psihat df test p.value EfSize.V1
1: Sleep on Young -0.77 245.45 -0.24 0.8082 0.12
2: Sleep on Old 1.65 184.45 0.44 0.6634 0.05
3: Age on Control -0.11 153.44 -0.03 0.9739 0.14
4: Age on SR 2.31 244.51 0.64 0.5236 0.06
$InterAC
Contr psihat df test p.value EfSize.V1
1: Age on M1 0.77 84.00 0.29 0.7700 0.04
2: Age on M2 -1.33 70.26 -0.58 0.5613 0.04
3: Age on M3 0.32 91.93 0.14 0.8851 0.03
4: Age on M4 3.02 96.36 1.61 0.1097 0.18
5: Age on M5 -0.57 78.02 -0.29 0.7738 0.05
6: M1-M2 on Young 3.47 NA 1.48 0.1541 0.05
7: M1-M2 on Old 1.23 NA 0.38 0.7104 0.02
8: M2-M3 on Young -2.05 NA -1.92 0.0683 0.07
9: M2-M3 on Old -1.62 NA -0.55 0.5871 0.02
10: M3-M4 on Young -0.47 NA -0.26 0.7992 0.06
11: M3-M4 on Old 3.73 NA 2.14 0.0445 0.23
12: M4-M5 on Young -0.44 NA -0.19 0.8482 0.03
13: M4-M5 on Old -4.40 NA -1.67 0.1107 0.19
$InterBC
Contr psihat df test p.value EfSize.V1
1: Sleep on M1 -0.02 84.00 -0.01 0.9954 0.01
2: Sleep on M2 2.72 70.26 1.19 0.2376 0.13
3: Sleep on M3 0.56 91.93 0.25 0.8015 0.01
4: Sleep on M4 -1.10 96.36 -0.59 0.5593 0.05
5: Sleep on M5 -1.28 78.02 -0.65 0.5190 0.09
6: M1-M2 on Young 1.55 NA 0.61 0.5488 0.04
7: M1-M2 on Old 4.16 NA 1.52 0.1443 0.08
8: M2-M3 on Young -0.69 NA -0.48 0.6334 0.00
9: M2-M3 on Old -3.68 NA -2.31 0.0311 0.11
10: M3-M4 on Young 2.77 NA 1.40 0.1774 0.19
11: M3-M4 on Old 1.53 NA 0.81 0.4278 0.09
12: M4-M5 on Young -0.59 NA -0.29 0.7775 0.07
13: M4-M5 on Old -2.94 NA -1.13 0.2712 0.08
$DetallMainC
Contr psihat test p.value Psihat2 p.value2 EfSize.V1
1: M1-M2 4.84 1.03 0.3140 0.27 0.848 0.02
2: M2-M3 -2.52 -0.83 0.4162 -1.93 0.444 0.05
3: M3-M4 1.73 0.85 0.4074 5.62 0.052 0.13
4: M4-M5 -2.95 -0.75 0.4589 -3.24 0.476 0.07
$DetallTrialCadaCondAB
Contr psihat df test p.value Psihat2 p.value2 dif.yuen df.yuen
1: M1-M2 on Y_C 0.32 NA 0.46 0.6497 -0.08 0.968 -0.08 35
2: M1-M2 on Y_SR 1.47 NA 1.50 0.1492 1.26 0.400 1.26 29
3: M1-M2 on O_C -1.24 NA -0.84 0.4125 -1.16 0.580 -1.16 21
4: M1-M2 on O_SR 0.72 NA 0.92 0.3658 0.24 0.704 0.24 24
5: M2-M3 on Y_C -0.01 NA -0.01 0.9908 0.19 0.832 0.19 35
6: M2-M3 on Y_SR -1.46 NA -2.17 0.0414 -1.98 0.212 -1.98 29
7: M2-M3 on O_C 0.26 NA 0.17 0.8669 -0.07 0.912 -0.07 21
8: M2-M3 on O_SR -0.97 NA -0.70 0.4911 -0.07 0.820 -0.07 24
9: M3-M4 on Y_C -0.19 NA -0.40 0.6917 0.57 0.564 0.57 35
10: M3-M4 on Y_SR -0.06 NA -0.04 0.9675 0.89 0.572 0.89 29
11: M3-M4 on O_C 2.31 NA 1.98 0.0605 3.06 0.052 3.06 21
12: M3-M4 on O_SR 0.28 NA 0.45 0.6564 1.09 0.452 1.09 24
13: M4-M5 on Y_C -0.69 NA -0.42 0.6823 0.14 0.868 -0.03 32
14: M4-M5 on Y_SR 0.13 NA 0.14 0.8907 0.04 1.000 0.04 29
15: M4-M5 on O_C -1.28 NA -0.93 0.3633 -1.66 0.356 -1.66 21
16: M4-M5 on O_SR -2.65 NA -1.82 0.0826 -1.75 0.476 -1.75 24
test.yuen EffSize.yuen pvaluet.yuen
1: -0.08 0.01 0.9347
2: 0.92 0.13 0.3655
3: -0.52 0.09 0.6060
4: 0.20 0.03 0.8447
5: 0.19 0.02 0.8502
6: -1.47 0.16 0.1518
7: -0.04 0.01 0.9649
8: -0.05 0.01 0.9623
9: 0.62 0.07 0.5377
10: 0.58 0.08 0.5638
11: 2.49 0.42 0.0211
12: 1.06 0.12 0.2983
13: -0.02 0.04 0.9823
14: 0.04 0.00 0.9703
15: -1.09 0.18 0.2890
16: -1.13 0.19 0.2682
$DetallSimple
$DetallSimple[[1]]
$DetallSimple[[1]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.09 0.771 0.09 0.771 0.07 0.7860 0.7646 0.775
2: Sleep 0.00 0.996 0.00 0.996 0.00 0.9655 0.9933 0.996
3: Age*Sleep 0.00 0.986 -0.02 0.780 0.03 0.8606 0.9850 0.979
EffSize
1: 0.04
2: 0.01
3: 0.01
$DetallSimple[[1]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.03 52.24 -0.02 0.9842 0.03 0.00 0.9800
2: Sleep on Old 0.02 43.54 0.01 0.9940 0.03 0.00 0.9911
3: Age on Control 0.36 34.15 0.20 0.8419 0.05 0.04 0.8444
4: Age on SR 0.41 51.63 0.21 0.8317 0.05 0.05 0.8400
EffSize.Boot
1: 0.02
2: 0.03
3: 0.05
4: 0.04
$DetallSimple[[1]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.03 52.24 -0.02 0.9842 0.02 0.00 0.9922
2: Sleep on Old 0.02 43.54 0.01 0.9940 0.03 0.00 0.9922
3: Age on Control 0.36 34.15 0.20 0.8419 0.05 0.04 0.8644
4: Age on SR 0.41 51.63 0.21 0.8317 0.04 0.05 0.8400
5: YSR vs OC 0.39 44.63 0.19 0.8484 0.05 0.04 0.8489
EffSize.Boot
1: 0.03
2: 0.03
3: 0.06
4: 0.04
5: 0.05
$DetallSimple[[2]]
$DetallSimple[[2]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.34 0.562 0.34 0.562 0.04 0.8372 0.5693 0.570
2: Sleep 1.42 0.238 1.42 0.238 1.24 0.2668 0.2270 0.243
3: Age*Sleep 0.00 0.964 0.01 0.910 0.04 0.8411 0.8080 0.969
EffSize
1: 0.05
2: 0.13
3: 0.04
$DetallSimple[[2]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 1.31 58.90 1.01 0.3189 0.15 1.01 0.3300
2: Sleep on Old 1.41 36.66 0.75 0.4565 0.14 0.57 0.4389
3: Age on Control -0.72 32.58 -0.40 0.6886 0.07 0.16 0.6833
4: Age on SR -0.61 52.40 -0.43 0.6701 0.06 0.18 0.6644
EffSize.Boot
1: 0.16
2: 0.14
3: 0.08
4: 0.05
$DetallSimple[[2]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 1.31 58.90 1.01 0.3189 0.14 1.01 0.3144
2: Sleep on Old 1.41 36.66 0.75 0.4565 0.15 0.57 0.4578
3: Age on Control -0.72 32.58 -0.40 0.6886 0.07 0.16 0.6700
4: Age on SR -0.61 52.40 -0.43 0.6701 0.06 0.18 0.6778
5: YSR vs OC -2.03 37.18 -1.08 0.2854 0.15 1.17 0.3044
EffSize.Boot
1: 0.15
2: 0.14
3: 0.07
4: 0.07
5: 0.17
$DetallSimple[[3]]
$DetallSimple[[3]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.02 0.886 0.02 0.886 0.03 0.8728 0.8781 0.898
2: Sleep 0.06 0.802 0.06 0.802 0.11 0.7365 0.7780 0.787
3: Age*Sleep 1.07 0.304 0.08 0.390 0.80 0.3728 0.3472 0.304
EffSize
1: 0.03
2: 0.01
3: 0.14
$DetallSimple[[3]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.86 47.07 -0.54 0.5940 0.08 0.29 0.5733
2: Sleep on Old 1.42 44.99 0.94 0.3530 0.15 0.88 0.3511
3: Age on Control -0.98 44.46 -0.75 0.4553 0.11 0.57 0.4811
4: Age on SR 1.30 52.12 0.73 0.4686 0.11 0.53 0.4778
EffSize.Boot
1: 0.09
2: 0.15
3: 0.13
4: 0.11
$DetallSimple[[3]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.86 47.07 -0.54 0.5940 0.07 0.29 0.5978
2: Sleep on Old 1.42 44.99 0.94 0.3530 0.16 0.88 0.3600
3: Age on Control -0.98 44.46 -0.75 0.4553 0.12 0.57 0.4622
4: Age on SR 1.30 52.12 0.73 0.4686 0.10 0.53 0.4522
5: YSR vs OC -0.12 49.06 -0.07 0.9458 0.05 0.00 0.9467
EffSize.Boot
1: 0.09
2: 0.14
3: 0.11
4: 0.11
5: 0.06
$DetallSimple[[4]]
$DetallSimple[[4]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 2.61 0.110 2.61 0.11 2.04 0.1556 0.0868 0.097
2: Sleep 0.34 0.560 0.34 0.56 0.16 0.6933 0.5342 0.557
3: Age*Sleep 0.00 0.996 -0.01 0.90 0.05 0.8314 0.9850 0.997
EffSize
1: 0.18
2: 0.06
3: 0.02
$DetallSimple[[4]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.54 56.21 -0.40 0.6930 0.05 0.16 0.6800
2: Sleep on Old -0.55 40.91 -0.43 0.6669 0.10 0.19 0.6600
3: Age on Control 1.51 55.39 1.39 0.1686 0.21 1.95 0.1511
4: Age on SR 1.50 52.79 0.99 0.3276 0.15 0.98 0.3356
EffSize.Boot
1: 0.04
2: 0.09
3: 0.20
4: 0.14
$DetallSimple[[4]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.54 56.21 -0.40 0.6930 0.06 0.16 0.6889
2: Sleep on Old -0.55 40.91 -0.43 0.6669 0.09 0.19 0.6678
3: Age on Control 1.51 55.39 1.39 0.1686 0.21 1.95 0.1511
4: Age on SR 1.50 52.79 0.99 0.3276 0.14 0.98 0.3322
5: YSR vs OC 2.06 47.02 1.58 0.1210 0.25 2.49 0.1311
EffSize.Boot
1: 0.06
2: 0.09
3: 0.21
4: 0.15
5: 0.25
$DetallSimple[[5]]
$DetallSimple[[5]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.08 0.774 0.08 0.774 0.29 0.5910 NA 1
2: Sleep 0.42 0.520 0.42 0.520 0.25 0.6203 NA 0 *
3: Age*Sleep 0.00 0.999 0.00 0.970 0.39 0.5326 NA 0 *
EffSize
1: 0.05
2: 0.09
3: 0.02
$DetallSimple[[5]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.64 51.12 -0.55 0.5837 0.08 0.30 0.6078
2: Sleep on Old -0.64 40.96 -0.40 0.6910 0.05 0.16 0.7022
3: Age on Control -0.28 31.80 -0.20 0.8422 0.04 0.04 0.8656
4: Age on SR -0.29 52.36 -0.21 0.8366 0.03 0.04 0.8411
EffSize.Boot
1: 0.10
2: 0.07
3: 0.05
4: 0.05
$DetallSimple[[5]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.64 51.12 -0.55 0.5837 0.08 0.30 0.5522
2: Sleep on Old -0.64 40.96 -0.40 0.6910 0.07 0.16 0.6889
3: Age on Control -0.28 31.80 -0.20 0.8422 0.05 0.04 0.8289
4: Age on SR -0.29 52.36 -0.21 0.8366 0.05 0.04 0.8133
5: YSR vs OC 0.36 42.28 0.22 0.8245 0.06 0.05 0.8389
EffSize.Boot
1: 0.09
2: 0.07
3: 0.05
4: 0.03
5: 0.04
| Names | Q | p | pBoot | Sig | pBootMas | Sig2 |
|---|---|---|---|---|---|---|
| Age | 0.12 | 0.7267 | 0.7129 | 0.7248 | ||
| Sleep | 0.02 | 0.8851 | 0.8948 | 0.8844 | ||
| Time | 0.48 | 0.7476 | 0.2287 | 0.3152 | ||
| Age*Sleep | 0.14 | 0.7101 | 0.7028 | 0.8466 | ||
| Age*Time | 0.32 | 0.8647 | 0.4541 | 0.5323 | ||
| Sleep*Time | 0.20 | 0.9370 | 0.6611 | 0.7317 | ||
| AgeSleepTime | 0.11 | 0.9805 | 0.8865 | 0.9004 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on Young | -0.77 | 245.45 | -0.24 | 0.8082 | 0.12 |
| Sleep on Old | 1.65 | 184.45 | 0.44 | 0.6634 | 0.05 |
| Age on Control | -0.11 | 153.44 | -0.03 | 0.9739 | 0.14 |
| Age on SR | 2.31 | 244.51 | 0.64 | 0.5236 | 0.06 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Age on M1 | 0.77 | 84.00 | 0.29 | 0.7700 | 0.04 |
| Age on M2 | -1.33 | 70.26 | -0.58 | 0.5613 | 0.04 |
| Age on M3 | 0.32 | 91.93 | 0.14 | 0.8851 | 0.03 |
| Age on M4 | 3.02 | 96.36 | 1.61 | 0.1097 | 0.18 |
| Age on M5 | -0.57 | 78.02 | -0.29 | 0.7738 | 0.05 |
| M1-M2 on Young | 3.47 | NA | 1.48 | 0.1541 | 0.05 |
| M1-M2 on Old | 1.23 | NA | 0.38 | 0.7104 | 0.02 |
| M2-M3 on Young | -2.05 | NA | -1.92 | 0.0683 | 0.07 |
| M2-M3 on Old | -1.62 | NA | -0.55 | 0.5871 | 0.02 |
| M3-M4 on Young | -0.47 | NA | -0.26 | 0.7992 | 0.06 |
| M3-M4 on Old | 3.73 | NA | 2.14 | 0.0445 | 0.23 |
| M4-M5 on Young | -0.44 | NA | -0.19 | 0.8482 | 0.03 |
| M4-M5 on Old | -4.40 | NA | -1.67 | 0.1107 | 0.19 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on M1 | -0.02 | 84.00 | -0.01 | 0.9954 | 0.01 |
| Sleep on M2 | 2.72 | 70.26 | 1.19 | 0.2376 | 0.13 |
| Sleep on M3 | 0.56 | 91.93 | 0.25 | 0.8015 | 0.01 |
| Sleep on M4 | -1.10 | 96.36 | -0.59 | 0.5593 | 0.05 |
| Sleep on M5 | -1.28 | 78.02 | -0.65 | 0.5190 | 0.09 |
| M1-M2 on Young | 1.55 | NA | 0.61 | 0.5488 | 0.04 |
| M1-M2 on Old | 4.16 | NA | 1.52 | 0.1443 | 0.08 |
| M2-M3 on Young | -0.69 | NA | -0.48 | 0.6334 | 0.00 |
| M2-M3 on Old | -3.68 | NA | -2.31 | 0.0311 | 0.11 |
| M3-M4 on Young | 2.77 | NA | 1.40 | 0.1774 | 0.19 |
| M3-M4 on Old | 1.53 | NA | 0.81 | 0.4278 | 0.09 |
| M4-M5 on Young | -0.59 | NA | -0.29 | 0.7775 | 0.07 |
| M4-M5 on Old | -2.94 | NA | -1.13 | 0.2712 | 0.08 |
| Contr | psihat | test | p.value | Psihat2 | p.value2 | EfSize.V1 |
|---|---|---|---|---|---|---|
| M1-M2 | 4.84 | 1.03 | 0.3140 | 0.27 | 0.848 | 0.02 |
| M2-M3 | -2.52 | -0.83 | 0.4162 | -1.93 | 0.444 | 0.05 |
| M3-M4 | 1.73 | 0.85 | 0.4074 | 5.62 | 0.052 | 0.13 |
| M4-M5 | -2.95 | -0.75 | 0.4589 | -3.24 | 0.476 | 0.07 |
| Contr | psihat | df | test | p.value | Psihat2 | p.value2 | dif.yuen | df.yuen | test.yuen | EffSize.yuen | pvaluet.yuen |
|---|---|---|---|---|---|---|---|---|---|---|---|
| M1-M2 on Y_C | 0.32 | NA | 0.46 | 0.6497 | -0.08 | 0.968 | -0.08 | 35 | -0.08 | 0.01 | 0.9347 |
| M1-M2 on Y_SR | 1.47 | NA | 1.50 | 0.1492 | 1.26 | 0.400 | 1.26 | 29 | 0.92 | 0.13 | 0.3655 |
| M1-M2 on O_C | -1.24 | NA | -0.84 | 0.4125 | -1.16 | 0.580 | -1.16 | 21 | -0.52 | 0.09 | 0.6060 |
| M1-M2 on O_SR | 0.72 | NA | 0.92 | 0.3658 | 0.24 | 0.704 | 0.24 | 24 | 0.20 | 0.03 | 0.8447 |
| M2-M3 on Y_C | -0.01 | NA | -0.01 | 0.9908 | 0.19 | 0.832 | 0.19 | 35 | 0.19 | 0.02 | 0.8502 |
| M2-M3 on Y_SR | -1.46 | NA | -2.17 | 0.0414 | -1.98 | 0.212 | -1.98 | 29 | -1.47 | 0.16 | 0.1518 |
| M2-M3 on O_C | 0.26 | NA | 0.17 | 0.8669 | -0.07 | 0.912 | -0.07 | 21 | -0.04 | 0.01 | 0.9649 |
| M2-M3 on O_SR | -0.97 | NA | -0.70 | 0.4911 | -0.07 | 0.820 | -0.07 | 24 | -0.05 | 0.01 | 0.9623 |
| M3-M4 on Y_C | -0.19 | NA | -0.40 | 0.6917 | 0.57 | 0.564 | 0.57 | 35 | 0.62 | 0.07 | 0.5377 |
| M3-M4 on Y_SR | -0.06 | NA | -0.04 | 0.9675 | 0.89 | 0.572 | 0.89 | 29 | 0.58 | 0.08 | 0.5638 |
| M3-M4 on O_C | 2.31 | NA | 1.98 | 0.0605 | 3.06 | 0.052 | 3.06 | 21 | 2.49 | 0.42 | 0.0211 |
| M3-M4 on O_SR | 0.28 | NA | 0.45 | 0.6564 | 1.09 | 0.452 | 1.09 | 24 | 1.06 | 0.12 | 0.2983 |
| M4-M5 on Y_C | -0.69 | NA | -0.42 | 0.6823 | 0.14 | 0.868 | -0.03 | 32 | -0.02 | 0.04 | 0.9823 |
| M4-M5 on Y_SR | 0.13 | NA | 0.14 | 0.8907 | 0.04 | 1.000 | 0.04 | 29 | 0.04 | 0.00 | 0.9703 |
| M4-M5 on O_C | -1.28 | NA | -0.93 | 0.3633 | -1.66 | 0.356 | -1.66 | 21 | -1.09 | 0.18 | 0.2890 |
| M4-M5 on O_SR | -2.65 | NA | -1.82 | 0.0826 | -1.75 | 0.476 | -1.75 | 24 | -1.13 | 0.19 | 0.2682 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.09 | 0.771 | 0.09 | 0.771 | 0.07 | 0.7860 | 0.7646 | 0.775 | 0.04 | ||
| Sleep | 0.00 | 0.996 | 0.00 | 0.996 | 0.00 | 0.9655 | 0.9933 | 0.996 | 0.01 | ||
| Age*Sleep | 0.00 | 0.986 | -0.02 | 0.780 | 0.03 | 0.8606 | 0.9850 | 0.979 | 0.01 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.03 | 52.24 | -0.02 | 0.9842 | 0.03 | 0.00 | 0.9800 | 0.02 |
| Sleep on Old | 0.02 | 43.54 | 0.01 | 0.9940 | 0.03 | 0.00 | 0.9911 | 0.03 |
| Age on Control | 0.36 | 34.15 | 0.20 | 0.8419 | 0.05 | 0.04 | 0.8444 | 0.05 |
| Age on SR | 0.41 | 51.63 | 0.21 | 0.8317 | 0.05 | 0.05 | 0.8400 | 0.04 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.03 | 52.24 | -0.02 | 0.9842 | 0.02 | 0.00 | 0.9922 | 0.03 |
| Sleep on Old | 0.02 | 43.54 | 0.01 | 0.9940 | 0.03 | 0.00 | 0.9922 | 0.03 |
| Age on Control | 0.36 | 34.15 | 0.20 | 0.8419 | 0.05 | 0.04 | 0.8644 | 0.06 |
| Age on SR | 0.41 | 51.63 | 0.21 | 0.8317 | 0.04 | 0.05 | 0.8400 | 0.04 |
| YSR vs OC | 0.39 | 44.63 | 0.19 | 0.8484 | 0.05 | 0.04 | 0.8489 | 0.05 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.34 | 0.562 | 0.34 | 0.562 | 0.04 | 0.8372 | 0.5693 | 0.570 | 0.05 | ||
| Sleep | 1.42 | 0.238 | 1.42 | 0.238 | 1.24 | 0.2668 | 0.2270 | 0.243 | 0.13 | ||
| Age*Sleep | 0.00 | 0.964 | 0.01 | 0.910 | 0.04 | 0.8411 | 0.8080 | 0.969 | 0.04 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 1.31 | 58.90 | 1.01 | 0.3189 | 0.15 | 1.01 | 0.3300 | 0.16 |
| Sleep on Old | 1.41 | 36.66 | 0.75 | 0.4565 | 0.14 | 0.57 | 0.4389 | 0.14 |
| Age on Control | -0.72 | 32.58 | -0.40 | 0.6886 | 0.07 | 0.16 | 0.6833 | 0.08 |
| Age on SR | -0.61 | 52.40 | -0.43 | 0.6701 | 0.06 | 0.18 | 0.6644 | 0.05 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 1.31 | 58.90 | 1.01 | 0.3189 | 0.14 | 1.01 | 0.3144 | 0.15 |
| Sleep on Old | 1.41 | 36.66 | 0.75 | 0.4565 | 0.15 | 0.57 | 0.4578 | 0.14 |
| Age on Control | -0.72 | 32.58 | -0.40 | 0.6886 | 0.07 | 0.16 | 0.6700 | 0.07 |
| Age on SR | -0.61 | 52.40 | -0.43 | 0.6701 | 0.06 | 0.18 | 0.6778 | 0.07 |
| YSR vs OC | -2.03 | 37.18 | -1.08 | 0.2854 | 0.15 | 1.17 | 0.3044 | 0.17 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.02 | 0.886 | 0.02 | 0.886 | 0.03 | 0.8728 | 0.8781 | 0.898 | 0.03 | ||
| Sleep | 0.06 | 0.802 | 0.06 | 0.802 | 0.11 | 0.7365 | 0.7780 | 0.787 | 0.01 | ||
| Age*Sleep | 1.07 | 0.304 | 0.08 | 0.390 | 0.80 | 0.3728 | 0.3472 | 0.304 | 0.14 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.86 | 47.07 | -0.54 | 0.5940 | 0.08 | 0.29 | 0.5733 | 0.09 |
| Sleep on Old | 1.42 | 44.99 | 0.94 | 0.3530 | 0.15 | 0.88 | 0.3511 | 0.15 |
| Age on Control | -0.98 | 44.46 | -0.75 | 0.4553 | 0.11 | 0.57 | 0.4811 | 0.13 |
| Age on SR | 1.30 | 52.12 | 0.73 | 0.4686 | 0.11 | 0.53 | 0.4778 | 0.11 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.86 | 47.07 | -0.54 | 0.5940 | 0.07 | 0.29 | 0.5978 | 0.09 |
| Sleep on Old | 1.42 | 44.99 | 0.94 | 0.3530 | 0.16 | 0.88 | 0.3600 | 0.14 |
| Age on Control | -0.98 | 44.46 | -0.75 | 0.4553 | 0.12 | 0.57 | 0.4622 | 0.11 |
| Age on SR | 1.30 | 52.12 | 0.73 | 0.4686 | 0.10 | 0.53 | 0.4522 | 0.11 |
| YSR vs OC | -0.12 | 49.06 | -0.07 | 0.9458 | 0.05 | 0.00 | 0.9467 | 0.06 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 2.61 | 0.110 | 2.61 | 0.11 | 2.04 | 0.1556 | 0.0868 | 0.097 | 0.18 | ||
| Sleep | 0.34 | 0.560 | 0.34 | 0.56 | 0.16 | 0.6933 | 0.5342 | 0.557 | 0.06 | ||
| Age*Sleep | 0.00 | 0.996 | -0.01 | 0.90 | 0.05 | 0.8314 | 0.9850 | 0.997 | 0.02 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.54 | 56.21 | -0.40 | 0.6930 | 0.05 | 0.16 | 0.6800 | 0.04 |
| Sleep on Old | -0.55 | 40.91 | -0.43 | 0.6669 | 0.10 | 0.19 | 0.6600 | 0.09 |
| Age on Control | 1.51 | 55.39 | 1.39 | 0.1686 | 0.21 | 1.95 | 0.1511 | 0.20 |
| Age on SR | 1.50 | 52.79 | 0.99 | 0.3276 | 0.15 | 0.98 | 0.3356 | 0.14 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.54 | 56.21 | -0.40 | 0.6930 | 0.06 | 0.16 | 0.6889 | 0.06 |
| Sleep on Old | -0.55 | 40.91 | -0.43 | 0.6669 | 0.09 | 0.19 | 0.6678 | 0.09 |
| Age on Control | 1.51 | 55.39 | 1.39 | 0.1686 | 0.21 | 1.95 | 0.1511 | 0.21 |
| Age on SR | 1.50 | 52.79 | 0.99 | 0.3276 | 0.14 | 0.98 | 0.3322 | 0.15 |
| YSR vs OC | 2.06 | 47.02 | 1.58 | 0.1210 | 0.25 | 2.49 | 0.1311 | 0.25 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.08 | 0.774 | 0.08 | 0.774 | 0.29 | 0.5910 | NA | 1 | 0.05 | ||
| Sleep | 0.42 | 0.520 | 0.42 | 0.520 | 0.25 | 0.6203 | NA | 0 |
|
0.09 | |
| Age*Sleep | 0.00 | 0.999 | 0.00 | 0.970 | 0.39 | 0.5326 | NA | 0 |
|
0.02 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.64 | 51.12 | -0.55 | 0.5837 | 0.08 | 0.30 | 0.6078 | 0.10 |
| Sleep on Old | -0.64 | 40.96 | -0.40 | 0.6910 | 0.05 | 0.16 | 0.7022 | 0.07 |
| Age on Control | -0.28 | 31.80 | -0.20 | 0.8422 | 0.04 | 0.04 | 0.8656 | 0.05 |
| Age on SR | -0.29 | 52.36 | -0.21 | 0.8366 | 0.03 | 0.04 | 0.8411 | 0.05 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.64 | 51.12 | -0.55 | 0.5837 | 0.08 | 0.30 | 0.5522 | 0.09 |
| Sleep on Old | -0.64 | 40.96 | -0.40 | 0.6910 | 0.07 | 0.16 | 0.6889 | 0.07 |
| Age on Control | -0.28 | 31.80 | -0.20 | 0.8422 | 0.05 | 0.04 | 0.8289 | 0.05 |
| Age on SR | -0.29 | 52.36 | -0.21 | 0.8366 | 0.05 | 0.04 | 0.8133 | 0.03 |
| YSR vs OC | 0.36 | 42.28 | 0.22 | 0.8245 | 0.06 | 0.05 | 0.8389 | 0.04 |
# Command selection. Copy the rest of the lines of code from the chunk of the reference figure and in the same order.
# Fig 2C Average rate remapping for all groups across trials {Design 2x2x(4xS)}
# As Fig.2B.
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"Parameters.csv"),Vars = ,c(1,5,6,32:35),vIntP =c(4:7),lvlCh = list("HABxT1"="RatRemap_Hab.S1", "T1xT2"="RatRemap_S1.S2","T2xT3"="RatRemap_S2.S3","T3xTest"="RatRemap_S3.test"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Rate and Global Remapping", "","Rate Remapping (Hz)"),ylmP =c(0,6),hLin = F,lvIp = 4)
names(rrt$DT)[4:7]<-c("T1","T2","T3","T4")
ResGen<-AOVMx2(A=2,B=2,C=4,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
<<ResCtrl3>> #Include here the chunk called ResCtrl3
# Fig 2D Average global remapping (map similarity) for all groups across trials {Design 2x2x(4xS)}
#As Fig.2B
rrt<-ExDataIS.2b(nmF = paste0(PathDesign,"Cell_types (ANOVA_Overall_correlations).csv"),Vars = ,c(3,4,12,7:10),vIntP =c(4:7),lvlCh = list("HABxT1"="s1xs2", "T1xT2"="s2xs3","T2xT3"="s3xs4","T3xTest"="s4xs5"))
#Graphs
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Rate and Global Remapping", "","Similarity Score"),ylmP =c(-0.5,1),hLin = T,lvIp = 4)
names(rrt$DT)[4:7]<-c("T1","T2","T3","T4")
ResGen<-AOVMx2(A=2,B=2,C=4,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
<<ResCtrl3>> #Include here the chunk called ResCtrl3Figure 3. Cell-type remapping across sessions during performance in the OPR task. A) Schematic indicating how similarity scores were computed. B-D) Average global remapping of context (B), object configuration (C), and unstable (D) cells across trials and corresponding examples of color-coded place cell rate maps, trajectory spike maps, and waveforms. Context cells are only unstable in the old control group, suggesting that poor performance in this group stems from inability to recall the context. Conversely, object configuration cells, which by definition remap when the objects are introduced, display intermediate levels of stability in young controls and old SD, the groups that show successful performance in the OPR task. Conversely, poor OPR performance is associated with either too much object configuration stability (young SD animals) or too much object configuration instability (old controls). No differences across conditions and/or time were observed in unstable cells. Blue indicates that the animal has visited the region but the cell has not fired, vivid colors indicate high neuronal activity (as shown in the color bar at the upper right corner). Number on top of each map represents peak firing rate (Hz) used to normalize the map colors. Red dots on the trajectory maps indicate location of action potentials. Waveform similarity indicates recording stability during the 24 hr period of training and testing. Context cells: Young controls (YC=23 cells), young SD (YSD=20 cells), old control (OC=8 cells), old SD (OSD=9 cells). Object cells: Young control (YC: 15 cells), young SD (YSD: 13 cells), old control (OC: 17 cells), old SD (OSD: 14 cells). Unstable cells: Young control (YC=22 cells), young SD (YSD=17 cells), old control (OC=11 cells), old SD (OSD=18 cells). Asterisks (*) represent significance using alpha=0.05. Statistical details in Supplemental Statistical Table corresponding to Figure 3.
NmBas="Fig3B ContextCells"
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
ResGen<-NA
rrt<-ExDataIS.3(nmF = paste0(PathDesign,"Cell_types (ANOVA_Overall_correlations).csv"),Vars = ,c(3,4,12,7:10),vIntP =c(4:7),lvlCh = list("HABxT1"="s1xs2", "T1xT2"="s2xs3","T2xT3"="s3xs4","T3xTest"="s4xs5"),TypCel = "Context")
DatDT<-rrt$DT
ArP<-rrt$Arp
ExtendDT<-rrt$ExtendDT
# For Simple Effects:
DatEfS<-list()
for(is in 1:4) {
DatEfS[[is]]<-ExData.2b(nmF = paste0(PathDesign,"Cell_types (ANOVA_Overall_correlations).csv"),Vars = c(3:4,(6+is)),TypCel = "Context")
names(DatEfS[[is]]$DT)[3]<-"DepV"
}
# Graphs
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Cell-Type Remapping Context Cells", "","Similarity Score"),ylmP =c(-0.5,1.2),hLin = T,lvIp = 4)
levBp<-seq(0.7, 5, by=0.2)
Grp2<- Grp + geom_signif(annotation="*",
y_position=0.95, xmin=levBp[1+15] , xmax=levBp[3+15],
tip_length = c(0.02, 0.02),textsize=6) +
geom_signif(annotation="*",
y_position=0.8, xmin=levBp[3+15] , xmax=levBp[4+15],
tip_length = c(0.02, 0.02),textsize=6)+
geom_signif(annotation=c("","","*"),
y_position=c(0.3,0.3,0.25),
xmin=c(levBp[1],levBp[1+5], mean(levBp[c(1,2)])),
xmax=c(levBp[2],levBp[2+5], mean(levBp[c(1+5,2+5)])),
tip_length = c(-0.02, -0.02),vjust=2,textsize=6)+
geom_signif(annotation=c("","","*"),
y_position=c(0.3,-0.35,-0.4),
xmin=c(levBp[1+10], levBp[1+15], mean(levBp[c(1+10,4+10)])),
xmax=c(levBp[4+10], levBp[4+15], mean(levBp[c(1+15,4+15)])),
tip_length = c(c(-0.02, -0.02),c(-0.02, -0.02),c(-.52, -0.02)),vjust=14,textsize=6)
#AOV
names(rrt$DT)[4:7]<-c("T1","T2","T3","T4")
ResGen<-AOVMx2(A=2,B=2,C=4,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
AlmacenGen2(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign,NmBasP = NmBas,Typ=2)
# Other Graphs
GrpO<-Grph.3.Otros(ExtendDT,LblsP =c("Cell-Type Remapping Context Cells", "B","Similarity Score"))
ExtendDTCol<-copy(ExtendDT)
ExtendDTCol$Moment<-"All"
ExtendDTCol<-data.table(rbind(ExtendDT,ExtendDTCol))
Grp3<-Grph.3(DatP = ExtendDTCol,"OPR",LblsP =c("Cell-Type Remapping Context Cells", "B","Similarity Score"),ylmP =c(-0.5,1.2),hLin = T,lvIp = 5,wMain = T)
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
GrpO
dev.off()
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
GrpO
plot(Grp3)
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResPas = ResGen[[1]], lbl = "Omnibus AOV. Design 2x2x(4xS)");cat("\n")
Kbl3(ResGen[[2]], "Interaction Age-Sleep. Design 2x2x(4xS)")
Kbl3(ResGen[[3]], "Interaction Age-Time. Design 2x2x(4xS)")
Kbl3(ResGen[[4]], "Interaction Sleep-Time. Design 2x2x(4xS)")
Kbl3(ResGen[[5]], "Main Effect Time. Design 2x2x(4xS)")
Kbl3(ResGen[[6]], "Simple Effect Time each Age-Sleep condition. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[1]][[1]], "Simple Effect Age-Sleep on Time=1 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[1]][[2]], "Simple Effect Age-Sleep on Time=1 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[1]][[3]], "Simple Effect Age-Sleep on Time=1 Extense Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[2]][[1]], "Simple Effect Age-Sleep on Time=2 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[2]][[2]], "Simple Effect Age-Sleep on Time=2 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[2]][[3]], "Simple Effect Age-Sleep on Time=2 Extense Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[3]][[1]], "Simple Effect Age-Sleep on Time=3 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[3]][[2]], "Simple Effect Age-Sleep on Time=3 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[3]][[3]], "Simple Effect Age-Sleep on Time=3 Extense Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[4]][[1]], "Simple Effect Age-Sleep on Time=4 Omnibus AOV. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[4]][[2]], "Simple Effect Age-Sleep on Time=4 Simple Effects. Design 2x2x(4xS)")
Kbl3(ResGen[[7]][[4]][[3]], "Simple Effect Age-Sleep on Time=4 Extense Simple Effects. Design 2x2x(4xS)") Eff p.V1 p.Sig
1: p.value.A 0.0100 *
2: p.value.B 0.9466
3: p.value.C 0.0000 *
4: p.value.AB 0.1336
5: p.value.AC 0.4674
6: p.value.BC 0.2170
7: p.value.ABC 0.0651
Eff p.V1 p.Sig
1: p.value.A 0.0073 *
2: p.value.B 0.9463
3: p.value.C 0.0000 *
4: p.value.AB 0.0005 *
5: p.value.AC 0.4687
6: p.value.BC 0.2285
7: p.value.ABC 0.0500
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
quartz_off_screen
2
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
$AOV
Names Q p pBoot Sig pBootMas Sig2
1: Age 7.87 0.0051 0.0100 * 0.0073 *
2: Sleep 0.00 0.9475 0.9466 0.9463
3: Time 3.04 0.0282 0.0000 * 0.0000 *
4: Age*Sleep 2.18 0.1404 0.1336 0.0005 *
5: Age*Time 0.25 0.8643 0.4674 0.4687
6: Sleep*Time 0.43 0.7319 0.2170 0.2285
7: Age*Sleep*Time 0.82 0.4844 0.0651 0.0500
$InterAB
Contr psihat df test p.value EfSize.V1
1: Sleep on Young 0.23 58.26 1.54 0.1297 0.28
2: Sleep on Old -0.24 21.91 -1.13 0.2725 0.29
3: Age on Control 0.67 19.96 3.33 0.0033 0.60
4: Age on SR 0.20 45.73 1.26 0.2127 0.23
$InterAC
Contr psihat df test p.value EfSize.V1
1: Age on M1 0.17 22.70 1.70 0.1036 0.34
2: Age on M2 0.15 18.57 1.48 0.1560 0.27
3: Age on M3 0.08 18.71 0.82 0.4220 0.15
4: Age on M4 0.46 15.18 2.49 0.0250 0.31
5: M1-M2 on Young -0.29 NA -3.46 0.0181 0.38
6: M1-M2 on Old -0.19 NA -1.84 0.1257 0.38
7: M2-M3 on Young 0.07 NA 0.62 0.5654 0.14
8: M2-M3 on Old -0.09 NA -0.81 0.4570 0.25
9: M3-M4 on Young 0.50 NA 3.32 0.0210 0.62
10: M3-M4 on Old 0.88 NA 3.63 0.0151 0.94
$InterBC
Contr psihat df test p.value EfSize.V1
1: Sleep on M1 0.16 22.70 1.57 0.1309 0.21
2: Sleep on M2 0.09 18.57 0.83 0.4162 0.11
3: Sleep on M3 0.07 18.71 0.65 0.5267 0.20
4: Sleep on M4 -0.32 15.18 -1.70 0.1101 0.08
5: M1-M2 on Control -0.15 NA -1.32 0.2437 0.31
6: M1-M2 on SR -0.31 NA -2.74 0.0407 0.47
7: M2-M3 on Control -0.07 NA -0.52 0.6262 0.22
8: M2-M3 on SR 0.01 NA 0.08 0.9385 0.10
9: M3-M4 on Control 0.70 NA 3.07 0.0279 0.76
10: M3-M4 on SR 0.69 NA 4.06 0.0097 0.67
$DetallMainC
Contr psihat test p.value Psihat2 p.value2 EfSize.V1
1: M1-M2 -0.46 -5.71 0.0023 -0.40 0.00 0.38
2: M2-M3 -0.05 -0.27 0.7977 -0.19 0.12 0.16
3: M3-M4 1.36 5.05 0.0039 1.32 0.00 0.69
$DetallTrialCadaCondAB
Contr psihat df test p.value Psihat2 p.value2 dif.yuen df.yuen
1: M1-M2 on Y_C -0.09 NA -1.19 0.2875 -0.09 0.000 -0.09 13
2: M1-M2 on Y_SR -0.18 NA -3.17 0.0247 -0.11 0.020 -0.11 11
3: M1-M2 on O_C -0.02 NA -0.27 0.7998 -0.08 0.416 -0.08 5
4: M1-M2 on O_SR -0.13 NA -1.86 0.1226 -0.13 0.092 -0.13 6
5: M2-M3 on Y_C -0.04 NA -0.65 0.5461 -0.06 0.112 -0.06 13
6: M2-M3 on Y_SR 0.07 NA 1.60 0.1697 -0.01 0.896 -0.01 11
7: M2-M3 on O_C -0.01 NA -0.14 0.8973 -0.03 0.652 -0.03 5
8: M2-M3 on O_SR -0.08 NA -1.52 0.1883 -0.10 0.096 -0.10 6
9: M3-M4 on Y_C 0.10 NA 1.53 0.1855 0.21 0.000 0.20 10
10: M3-M4 on Y_SR 0.40 NA 3.66 0.0146 0.26 0.000 0.26 11
11: M3-M4 on O_C 0.58 NA 2.28 0.0712 0.64 0.000 0.64 5
12: M3-M4 on O_SR 0.27 NA 2.12 0.0879 0.21 0.008 0.21 6
test.yuen EffSize.yuen pvaluet.yuen
1: -2.20 0.29 0.0461
2: -2.26 0.53 0.0451
3: -1.07 0.34 0.3346
4: -1.92 0.41 0.1033
5: -1.43 0.23 0.1774
6: -0.11 0.02 0.9106
7: -0.38 0.12 0.7226
8: -1.84 0.35 0.1155
9: 4.00 0.57 0.0025
10: 3.21 0.61 0.0082
11: 3.77 0.96 0.0131
12: 2.52 0.77 0.0451
$DetallSimple
$DetallSimple[[1]]
$DetallSimple[[1]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 2.88 0.103 2.88 0.103 1.78 0.1931 0.1018 0.108
2: Sleep 2.46 0.131 2.46 0.131 1.94 0.1748 0.1319 0.136
3: Age*Sleep 0.75 0.397 0.11 0.540 0.58 0.4546 0.4290 0.372
EffSize
1: 0.29
2: 0.21
3: 0.24
$DetallSimple[[1]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.04 23.26 0.52 0.6107 0.13 0.27 0.5844
2: Sleep on Old 0.12 8.26 1.66 0.1343 0.42 2.76 0.1656
3: Age on Control 0.04 12.47 0.50 0.6255 0.19 0.25 0.6222
4: Age on SR 0.13 16.36 2.30 0.0350 0.45 5.28 0.0389
EffSize.Boot
1: 0.10
2: 0.42
3: 0.17
4: 0.46
$DetallSimple[[1]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.04 23.26 0.52 0.6107 0.13 0.27 0.6322
2: Sleep on Old 0.12 8.26 1.66 0.1343 0.42 2.76 0.1311
3: Age on Control 0.04 12.47 0.50 0.6255 0.17 0.25 0.6556
4: Age on SR 0.13 16.36 2.30 0.0350 0.45 5.28 0.0422
5: YSR vs OC 0.01 9.44 0.09 0.9339 0.13 0.01 0.9211
EffSize.Boot
1: 0.12
2: 0.42
3: 0.14
4: 0.46
5: 0.11
$DetallSimple[[2]]
$DetallSimple[[2]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 2.19 0.156 2.19 0.156 1.79 0.1933 0.1619 0.154
2: Sleep 0.69 0.416 0.69 0.416 0.10 0.7561 0.4073 0.420
3: Age*Sleep 0.29 0.598 0.10 0.590 0.10 0.7489 0.6811 0.563
EffSize
1: 0.28
2: 0.11
3: 0.18
$DetallSimple[[2]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.02 20.25 0.29 0.7777 0.10 0.08 0.7744
2: Sleep on Old 0.07 10.73 0.80 0.4421 0.25 0.64 0.4700
3: Age on Control 0.05 8.30 0.78 0.4566 0.21 0.61 0.4794
4: Age on SR 0.10 10.68 1.26 0.2334 0.35 1.60 0.2533
EffSize.Boot
1: 0.09
2: 0.20
3: 0.18
4: 0.33
$DetallSimple[[2]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.02 20.25 0.29 0.7777 0.06 0.08 0.7778
2: Sleep on Old 0.07 10.73 0.80 0.4421 0.20 0.64 0.4344
3: Age on Control 0.05 8.30 0.78 0.4566 0.23 0.61 0.4711
4: Age on SR 0.10 10.68 1.26 0.2334 0.34 1.60 0.2467
5: YSR vs OC 0.03 11.36 0.48 0.6405 0.28 0.23 0.6778
EffSize.Boot
1: 0.10
2: 0.23
3: 0.26
4: 0.35
5: 0.23
$DetallSimple[[3]]
$DetallSimple[[3]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.67 0.422 0.67 0.422 0.75 0.3933 0.4508 0.433
2: Sleep 0.42 0.527 0.42 0.527 0.23 0.6367 0.5376 0.565
3: Age*Sleep 0.46 0.507 -0.11 0.560 0.95 0.3380 0.6661 0.523
EffSize
1: 0.16
2: 0.21
3: 0.23
$DetallSimple[[3]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.07 23.60 1.22 0.2355 0.28 1.48 0.2422
2: Sleep on Old 0.00 9.99 -0.02 0.9853 0.08 0.00 0.9856
3: Age on Control 0.08 9.38 0.96 0.3620 0.27 0.92 0.3744
4: Age on SR 0.01 11.09 0.12 0.9101 0.14 0.01 0.9022
EffSize.Boot
1: 0.24
2: 0.06
3: 0.24
4: 0.17
$DetallSimple[[3]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.07 23.60 1.22 0.2355 0.29 1.48 0.2089
2: Sleep on Old 0.00 9.99 -0.02 0.9853 0.04 0.00 0.9900
3: Age on Control 0.08 9.38 0.96 0.3620 0.23 0.92 0.3711
4: Age on SR 0.01 11.09 0.12 0.9101 0.15 0.01 0.9111
5: YSR vs OC 0.01 7.79 0.12 0.9085 0.17 0.01 0.9200
EffSize.Boot
1: 0.30
2: 0.08
3: 0.28
4: 0.16
5: 0.13
$DetallSimple[[4]]
$DetallSimple[[4]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 6.19 0.024 6.19 0.024 7.97 0.0080 NA 1
2: Sleep 2.88 0.109 2.88 0.109 0.23 0.6333 NA 0 *
3: Age*Sleep 8.35 0.010 -0.38 0.020 8.53 0.0063 NA 0 *
EffSize
1: 0.35
2: 0.08
3: 0.62
$DetallSimple[[4]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.11 20.06 1.03 0.3167 0.21 1.05 0.3078
2: Sleep on Old -0.43 7.30 -2.82 0.0248 0.61 7.93 0.0389
3: Age on Control 0.50 7.38 3.31 0.0120 0.65 10.94 0.0189
4: Age on SR -0.04 16.97 -0.35 0.7343 0.17 0.12 0.6967
EffSize.Boot
1: 0.23
2: 0.61
3: 0.67
4: 0.15
$DetallSimple[[4]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.11 20.06 1.03 0.3167 0.23 1.05 0.2978
2: Sleep on Old -0.43 7.30 -2.82 0.0248 0.61 7.93 0.0334
3: Age on Control 0.50 7.38 3.31 0.0120 0.65 10.94 0.0156
4: Age on SR -0.04 16.97 -0.35 0.7343 0.16 0.12 0.7778
5: YSR vs OC 0.39 9.11 2.42 0.0385 0.64 5.84 0.0467
EffSize.Boot
1: 0.23
2: 0.61
3: 0.64
4: 0.18
5: 0.65
| Names | Q | p | pBoot | Sig | pBootMas | Sig2 |
|---|---|---|---|---|---|---|
| Age | 7.87 | 0.0051 | 0.0100 |
|
0.0073 |
|
| Sleep | 0.00 | 0.9475 | 0.9466 | 0.9463 | ||
| Time | 3.04 | 0.0282 | 0.0000 |
|
0.0000 |
|
| Age*Sleep | 2.18 | 0.1404 | 0.1336 | 0.0005 |
|
|
| Age*Time | 0.25 | 0.8643 | 0.4674 | 0.4687 | ||
| Sleep*Time | 0.43 | 0.7319 | 0.2170 | 0.2285 | ||
| AgeSleepTime | 0.82 | 0.4844 | 0.0651 | 0.0500 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on Young | 0.23 | 58.26 | 1.54 | 0.1297 | 0.28 |
| Sleep on Old | -0.24 | 21.91 | -1.13 | 0.2725 | 0.29 |
| Age on Control | 0.67 | 19.96 | 3.33 | 0.0033 | 0.60 |
| Age on SR | 0.20 | 45.73 | 1.26 | 0.2127 | 0.23 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Age on M1 | 0.17 | 22.70 | 1.70 | 0.1036 | 0.34 |
| Age on M2 | 0.15 | 18.57 | 1.48 | 0.1560 | 0.27 |
| Age on M3 | 0.08 | 18.71 | 0.82 | 0.4220 | 0.15 |
| Age on M4 | 0.46 | 15.18 | 2.49 | 0.0250 | 0.31 |
| M1-M2 on Young | -0.29 | NA | -3.46 | 0.0181 | 0.38 |
| M1-M2 on Old | -0.19 | NA | -1.84 | 0.1257 | 0.38 |
| M2-M3 on Young | 0.07 | NA | 0.62 | 0.5654 | 0.14 |
| M2-M3 on Old | -0.09 | NA | -0.81 | 0.4570 | 0.25 |
| M3-M4 on Young | 0.50 | NA | 3.32 | 0.0210 | 0.62 |
| M3-M4 on Old | 0.88 | NA | 3.63 | 0.0151 | 0.94 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on M1 | 0.16 | 22.70 | 1.57 | 0.1309 | 0.21 |
| Sleep on M2 | 0.09 | 18.57 | 0.83 | 0.4162 | 0.11 |
| Sleep on M3 | 0.07 | 18.71 | 0.65 | 0.5267 | 0.20 |
| Sleep on M4 | -0.32 | 15.18 | -1.70 | 0.1101 | 0.08 |
| M1-M2 on Control | -0.15 | NA | -1.32 | 0.2437 | 0.31 |
| M1-M2 on SR | -0.31 | NA | -2.74 | 0.0407 | 0.47 |
| M2-M3 on Control | -0.07 | NA | -0.52 | 0.6262 | 0.22 |
| M2-M3 on SR | 0.01 | NA | 0.08 | 0.9385 | 0.10 |
| M3-M4 on Control | 0.70 | NA | 3.07 | 0.0279 | 0.76 |
| M3-M4 on SR | 0.69 | NA | 4.06 | 0.0097 | 0.67 |
| Contr | psihat | test | p.value | Psihat2 | p.value2 | EfSize.V1 |
|---|---|---|---|---|---|---|
| M1-M2 | -0.46 | -5.71 | 0.0023 | -0.40 | 0.00 | 0.38 |
| M2-M3 | -0.05 | -0.27 | 0.7977 | -0.19 | 0.12 | 0.16 |
| M3-M4 | 1.36 | 5.05 | 0.0039 | 1.32 | 0.00 | 0.69 |
| Contr | psihat | df | test | p.value | Psihat2 | p.value2 | dif.yuen | df.yuen | test.yuen | EffSize.yuen | pvaluet.yuen |
|---|---|---|---|---|---|---|---|---|---|---|---|
| M1-M2 on Y_C | -0.09 | NA | -1.19 | 0.2875 | -0.09 | 0.000 | -0.09 | 13 | -2.20 | 0.29 | 0.0461 |
| M1-M2 on Y_SR | -0.18 | NA | -3.17 | 0.0247 | -0.11 | 0.020 | -0.11 | 11 | -2.26 | 0.53 | 0.0451 |
| M1-M2 on O_C | -0.02 | NA | -0.27 | 0.7998 | -0.08 | 0.416 | -0.08 | 5 | -1.07 | 0.34 | 0.3346 |
| M1-M2 on O_SR | -0.13 | NA | -1.86 | 0.1226 | -0.13 | 0.092 | -0.13 | 6 | -1.92 | 0.41 | 0.1033 |
| M2-M3 on Y_C | -0.04 | NA | -0.65 | 0.5461 | -0.06 | 0.112 | -0.06 | 13 | -1.43 | 0.23 | 0.1774 |
| M2-M3 on Y_SR | 0.07 | NA | 1.60 | 0.1697 | -0.01 | 0.896 | -0.01 | 11 | -0.11 | 0.02 | 0.9106 |
| M2-M3 on O_C | -0.01 | NA | -0.14 | 0.8973 | -0.03 | 0.652 | -0.03 | 5 | -0.38 | 0.12 | 0.7226 |
| M2-M3 on O_SR | -0.08 | NA | -1.52 | 0.1883 | -0.10 | 0.096 | -0.10 | 6 | -1.84 | 0.35 | 0.1155 |
| M3-M4 on Y_C | 0.10 | NA | 1.53 | 0.1855 | 0.21 | 0.000 | 0.20 | 10 | 4.00 | 0.57 | 0.0025 |
| M3-M4 on Y_SR | 0.40 | NA | 3.66 | 0.0146 | 0.26 | 0.000 | 0.26 | 11 | 3.21 | 0.61 | 0.0082 |
| M3-M4 on O_C | 0.58 | NA | 2.28 | 0.0712 | 0.64 | 0.000 | 0.64 | 5 | 3.77 | 0.96 | 0.0131 |
| M3-M4 on O_SR | 0.27 | NA | 2.12 | 0.0879 | 0.21 | 0.008 | 0.21 | 6 | 2.52 | 0.77 | 0.0451 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 2.88 | 0.103 | 2.88 | 0.103 | 1.78 | 0.1931 | 0.1018 | 0.108 | 0.29 | ||
| Sleep | 2.46 | 0.131 | 2.46 | 0.131 | 1.94 | 0.1748 | 0.1319 | 0.136 | 0.21 | ||
| Age*Sleep | 0.75 | 0.397 | 0.11 | 0.540 | 0.58 | 0.4546 | 0.4290 | 0.372 | 0.24 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.04 | 23.26 | 0.52 | 0.6107 | 0.13 | 0.27 | 0.5844 | 0.10 |
| Sleep on Old | 0.12 | 8.26 | 1.66 | 0.1343 | 0.42 | 2.76 | 0.1656 | 0.42 |
| Age on Control | 0.04 | 12.47 | 0.50 | 0.6255 | 0.19 | 0.25 | 0.6222 | 0.17 |
| Age on SR | 0.13 | 16.36 | 2.30 | 0.0350 | 0.45 | 5.28 | 0.0389 | 0.46 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.04 | 23.26 | 0.52 | 0.6107 | 0.13 | 0.27 | 0.6322 | 0.12 |
| Sleep on Old | 0.12 | 8.26 | 1.66 | 0.1343 | 0.42 | 2.76 | 0.1311 | 0.42 |
| Age on Control | 0.04 | 12.47 | 0.50 | 0.6255 | 0.17 | 0.25 | 0.6556 | 0.14 |
| Age on SR | 0.13 | 16.36 | 2.30 | 0.0350 | 0.45 | 5.28 | 0.0422 | 0.46 |
| YSR vs OC | 0.01 | 9.44 | 0.09 | 0.9339 | 0.13 | 0.01 | 0.9211 | 0.11 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 2.19 | 0.156 | 2.19 | 0.156 | 1.79 | 0.1933 | 0.1619 | 0.154 | 0.28 | ||
| Sleep | 0.69 | 0.416 | 0.69 | 0.416 | 0.10 | 0.7561 | 0.4073 | 0.420 | 0.11 | ||
| Age*Sleep | 0.29 | 0.598 | 0.10 | 0.590 | 0.10 | 0.7489 | 0.6811 | 0.563 | 0.18 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.02 | 20.25 | 0.29 | 0.7777 | 0.10 | 0.08 | 0.7744 | 0.09 |
| Sleep on Old | 0.07 | 10.73 | 0.80 | 0.4421 | 0.25 | 0.64 | 0.4700 | 0.20 |
| Age on Control | 0.05 | 8.30 | 0.78 | 0.4566 | 0.21 | 0.61 | 0.4794 | 0.18 |
| Age on SR | 0.10 | 10.68 | 1.26 | 0.2334 | 0.35 | 1.60 | 0.2533 | 0.33 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.02 | 20.25 | 0.29 | 0.7777 | 0.06 | 0.08 | 0.7778 | 0.10 |
| Sleep on Old | 0.07 | 10.73 | 0.80 | 0.4421 | 0.20 | 0.64 | 0.4344 | 0.23 |
| Age on Control | 0.05 | 8.30 | 0.78 | 0.4566 | 0.23 | 0.61 | 0.4711 | 0.26 |
| Age on SR | 0.10 | 10.68 | 1.26 | 0.2334 | 0.34 | 1.60 | 0.2467 | 0.35 |
| YSR vs OC | 0.03 | 11.36 | 0.48 | 0.6405 | 0.28 | 0.23 | 0.6778 | 0.23 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.67 | 0.422 | 0.67 | 0.422 | 0.75 | 0.3933 | 0.4508 | 0.433 | 0.16 | ||
| Sleep | 0.42 | 0.527 | 0.42 | 0.527 | 0.23 | 0.6367 | 0.5376 | 0.565 | 0.21 | ||
| Age*Sleep | 0.46 | 0.507 | -0.11 | 0.560 | 0.95 | 0.3380 | 0.6661 | 0.523 | 0.23 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.07 | 23.60 | 1.22 | 0.2355 | 0.28 | 1.48 | 0.2422 | 0.24 |
| Sleep on Old | 0.00 | 9.99 | -0.02 | 0.9853 | 0.08 | 0.00 | 0.9856 | 0.06 |
| Age on Control | 0.08 | 9.38 | 0.96 | 0.3620 | 0.27 | 0.92 | 0.3744 | 0.24 |
| Age on SR | 0.01 | 11.09 | 0.12 | 0.9101 | 0.14 | 0.01 | 0.9022 | 0.17 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.07 | 23.60 | 1.22 | 0.2355 | 0.29 | 1.48 | 0.2089 | 0.30 |
| Sleep on Old | 0.00 | 9.99 | -0.02 | 0.9853 | 0.04 | 0.00 | 0.9900 | 0.08 |
| Age on Control | 0.08 | 9.38 | 0.96 | 0.3620 | 0.23 | 0.92 | 0.3711 | 0.28 |
| Age on SR | 0.01 | 11.09 | 0.12 | 0.9101 | 0.15 | 0.01 | 0.9111 | 0.16 |
| YSR vs OC | 0.01 | 7.79 | 0.12 | 0.9085 | 0.17 | 0.01 | 0.9200 | 0.13 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 6.19 | 0.024 | 6.19 | 0.024 | 7.97 | 0.0080 | NA | 1 | 0.35 | ||
| Sleep | 2.88 | 0.109 | 2.88 | 0.109 | 0.23 | 0.6333 | NA | 0 |
|
0.08 | |
| Age*Sleep | 8.35 | 0.010 | -0.38 | 0.020 | 8.53 | 0.0063 | NA | 0 |
|
0.62 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.11 | 20.06 | 1.03 | 0.3167 | 0.21 | 1.05 | 0.3078 | 0.23 |
| Sleep on Old | -0.43 | 7.30 | -2.82 | 0.0248 | 0.61 | 7.93 | 0.0389 | 0.61 |
| Age on Control | 0.50 | 7.38 | 3.31 | 0.0120 | 0.65 | 10.94 | 0.0189 | 0.67 |
| Age on SR | -0.04 | 16.97 | -0.35 | 0.7343 | 0.17 | 0.12 | 0.6967 | 0.15 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.11 | 20.06 | 1.03 | 0.3167 | 0.23 | 1.05 | 0.2978 | 0.23 |
| Sleep on Old | -0.43 | 7.30 | -2.82 | 0.0248 | 0.61 | 7.93 | 0.0334 | 0.61 |
| Age on Control | 0.50 | 7.38 | 3.31 | 0.0120 | 0.65 | 10.94 | 0.0156 | 0.64 |
| Age on SR | -0.04 | 16.97 | -0.35 | 0.7343 | 0.16 | 0.12 | 0.7778 | 0.18 |
| YSR vs OC | 0.39 | 9.11 | 2.42 | 0.0385 | 0.64 | 5.84 | 0.0467 | 0.65 |
# Command selection. Copy the rest of the lines of code from the chunk of the reference figure and in the same order.
# Fig 3C Average global remapping of object configuration cells {Design 2x2x(4xS)}
# As Fig.3B
rrt<-ExDataIS.3(nmF = paste0(PathDesign,"Cell_types (ANOVA_Overall_correlations).csv"),Vars = ,c(3,4,12,7:10),vIntP =c(4:7),lvlCh = list("HABxT1"="s1xs2", "T1xT2"="s2xs3","T2xT3"="s3xs4","T3xTest"="s4xs5"),TypCel = "Object")
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Cell-Type Remapping Object Cells", "","Similarity Score"),ylmP =c(-0.5,1.2),hLin = T,lvIp = 4)
ResGen<-AOVMx2(A=2,B=2,C=4,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
# Fig 3D Average global remapping of unstable cells across trials {Design 2x2x(4xS)}
# As Fig.3B
rrt<-ExDataIS.3(nmF = paste0(PathDesign,"Cell_types (ANOVA_Overall_correlations).csv"),Vars = ,c(3,4,12,7:10),vIntP =c(4:7),lvlCh = list("HABxT1"="s1xs2", "T1xT2"="s2xs3","T2xT3"="s3xs4","T3xTest"="s4xs5"),TypCel = "Unstable")
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Cell-Type Remapping Unstable Cells", "","Similarity Score"),ylmP =c(-0.5,1.2),hLin = T,lvIp = 4)
ResGen<-AOVMx2(A=2,B=2,C=4,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)Figure 4. Place cell stability during unmoved object control task. A) Schematics of the task. B) Isolation distance showing absence of differences in spike cluster quality across conditions over time. C-E) Examples of context (C), object configuration (D), and unstable (D) rate maps, trajectory spike maps, and waveforms recorded from young and old control mice trained in the unmoved object control task. Context and object configuration cells recorded in young mice were more stable during the test than those recorded in old controls. Unstable cells did not show differences across groups and/or time. Blue indicates that the animal has visited the region but the cell has not fired, vivid colors indicate high neuronal activity (as shown in the color bar at the upper right corner). Number on top of each map represents peak firing rate (Hz) used to normalize the map colors. Red dots on the trajectory maps indicate location of action potentials. Waveform similarity indicates recording stability during the 24 hr period of training and testing. Young: 3 mice, 30 cells, old: 4 mice, 24 cells. Asterisks (*) represent significance using alpha=0.05. Statistical details in Supplemental Statistical Table corresponding to Figure 4.
NmBas="Fig4B UnMovedIsolationDistance"
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
ResGen<-NA
rrt<-ExDataIS.3c(nmF = paste0(PathDesign,"ClusterQualityNonMovedControlIsolation.csv"),Vars = ,c(4,5,1,6:10),vIntP =c(4:8),lvlCh = list("HAB"="id_s1", "T1"="id_s2","T2"="id_s3","T3"="id_s4","Test"="id_s5"))
DatDT<-rrt$DT
ArP<-rrt$Arp
ExtendDT<-rrt$ExtendDT
#Graphs
Grp<- Grph.3b(DatP = ExtendDT,"OPR",LblsP =c("Cluster Quality", "","Isolation Distance"),ylmP =c(0,40),hLin = F,lvIp = 5,GrpSel = c(1,3))
Grp2=Grp
#AOV
names(rrt$DT)[3:7]<-c("T1","T2","T3","T4","T5")
ResGen<-AOVMx2b(A=2,C=5,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
AlmacenGen(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign,NmBasP = NmBas,Typ=1)
# Other Graphs
ExtendDTCol<-copy(ExtendDT)
ExtendDTCol$Moment<-"All"
ExtendDTCol<-data.table(rbind(ExtendDT,ExtendDTCol))
Grp3<- Grph.3b(DatP = ExtendDTCol,"OPR",LblsP =c("Cluster Quality", "","Isolation Distance"),ylmP =c(0,40),hLin = F,lvIp = 6,GrpSel = c(1,3),wMain = T)
ExtendCpy<-copy(ExtendDT)
names(ExtendCpy)[1]<-"Age"
GrpO<-Grph.3.Otrosb(ExtendDTp = ExtendCpy,LblsP =c("Cluster Quality", "","Isolation Distance"))
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
GrpO
dev.off()
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResGen[[1]], "Omnibus AOV. Design 2x(5xS)");cat("\n")
Kbl3(ResGen[[2]], "Simple Effects Age-Time. Design 2x(5xS)")
Kbl3(ResGen[[3]], "Main Effects of Time. Design 2x(5xS)")[1] "Taking bootstrap samples. Please wait."
[1] "Taking bootstrap samples. Please wait."
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$BP
$Bars
$MargAC
$MargC
quartz_off_screen
2
$AOV
Names Q p pBoot Sig pBootMas Sig2 EffSize
1: Age 2.58 0.1252 0.1486 0.1307 0.30
2: Trial 1.54 0.2295 0.2154 0.2117 0.16
3: Age*Trial 1.22 0.3323 0.3723 0.3185 0.10
$InterAC
Contr psihat df test p.value EfSize.V1
1: Age on M1 1.15 21.76 1.73 0.0970 0.35
2: Age on M2 0.76 19.51 1.15 0.2639 0.28
3: Age on M3 1.23 20.39 1.45 0.1625 0.36
4: Age on M4 0.27 19.12 0.41 0.6830 0.11
5: Age on M5 0.87 23.51 1.53 0.1391 0.35
6: M1-M2 on Young 0.15 NA 0.23 0.8185 0.09
7: M1-M2 on Old -0.04 NA -0.14 0.8918 0.02
8: M2-M3 on Young 0.06 NA 0.13 0.8953 0.03
9: M2-M3 on Old 0.19 NA 0.54 0.5992 0.14
10: M3-M4 on Young 0.24 NA 0.69 0.5026 0.13
11: M3-M4 on Old -0.63 NA -2.61 0.0228 0.18
12: M4-M5 on Young -0.99 NA -1.31 0.2146 0.36
13: M4-M5 on Old -0.54 NA -0.89 0.3923 0.35
$DetallMainC
Contr psihat test p.value Psihat2 p.value2 EfSize.V1
1: M1-M2 0.46 0.73 0.4798 0.31 0.580 0.07
2: M2-M3 -0.19 -0.39 0.7033 0.20 0.724 0.04
3: M3-M4 -0.38 -0.72 0.4876 0.10 0.872 0.00
4: M4-M5 -2.11 -2.60 0.0233 -2.03 0.024 0.35
| Names | Q | p | pBoot | Sig | pBootMas | Sig2 | EffSize |
|---|---|---|---|---|---|---|---|
| Age | 2.58 | 0.1252 | 0.1486 | 0.1307 | 0.30 | ||
| Trial | 1.54 | 0.2295 | 0.2154 | 0.2117 | 0.16 | ||
| Age*Trial | 1.22 | 0.3323 | 0.3723 | 0.3185 | 0.10 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Age on M1 | 1.15 | 21.76 | 1.73 | 0.0970 | 0.35 |
| Age on M2 | 0.76 | 19.51 | 1.15 | 0.2639 | 0.28 |
| Age on M3 | 1.23 | 20.39 | 1.45 | 0.1625 | 0.36 |
| Age on M4 | 0.27 | 19.12 | 0.41 | 0.6830 | 0.11 |
| Age on M5 | 0.87 | 23.51 | 1.53 | 0.1391 | 0.35 |
| M1-M2 on Young | 0.15 | NA | 0.23 | 0.8185 | 0.09 |
| M1-M2 on Old | -0.04 | NA | -0.14 | 0.8918 | 0.02 |
| M2-M3 on Young | 0.06 | NA | 0.13 | 0.8953 | 0.03 |
| M2-M3 on Old | 0.19 | NA | 0.54 | 0.5992 | 0.14 |
| M3-M4 on Young | 0.24 | NA | 0.69 | 0.5026 | 0.13 |
| M3-M4 on Old | -0.63 | NA | -2.61 | 0.0228 | 0.18 |
| M4-M5 on Young | -0.99 | NA | -1.31 | 0.2146 | 0.36 |
| M4-M5 on Old | -0.54 | NA | -0.89 | 0.3923 | 0.35 |
| Contr | psihat | test | p.value | Psihat2 | p.value2 | EfSize.V1 |
|---|---|---|---|---|---|---|
| M1-M2 | 0.46 | 0.73 | 0.4798 | 0.31 | 0.580 | 0.07 |
| M2-M3 | -0.19 | -0.39 | 0.7033 | 0.20 | 0.724 | 0.04 |
| M3-M4 | -0.38 | -0.72 | 0.4876 | 0.10 | 0.872 | 0.00 |
| M4-M5 | -2.11 | -2.60 | 0.0233 | -2.03 | 0.024 | 0.35 |
# Command selection. Copy the rest of the lines of code from the chunk of the reference figure and in the same order.
# Fig 4C Unmoved Controls Global Remapping Context Cells {Design 2x(4xS)}
# As Fig.4B
rrt<-ExDataIS.3b(nmF = paste0(PathDesign,"NonMovedControls Final.csv"),Vars = ,c(3,4,12,7:10),vIntP =c(4:7),lvlCh = list("HABxT1"="s1xs2", "T1xT2"="s2xs3","T2xT3"="s3xs4","T3xTest"="s4xs5"),TypCel = "Context")
Grp<- Grph.3b(DatP = ExtendDT,"OPR",LblsP =c("Unmoved Object Control Context Cells", "","Similarity Score"),ylmP =c(-0.5,1.2),hLin = T,lvIp = 4,GrpSel = c(1,3))
names(rrt$DT)[3:6]<-c("T1","T2","T3","T4")
ResGen<-AOVMx2b(A=2,C=4,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
<<ResCtrl5>> #Include here the chunk called ResCtrl3
# Fig 4D Unmoved Controls Global Remapping Object configuration Cells {Design 2x(4xS)}
# As Fig.4B
rrt<-ExDataIS.3b(nmF = paste0(PathDesign,"NonMovedControls Final.csv"),Vars = ,c(3,4,12,7:10),vIntP =c(4:7),lvlCh = list("HABxT1"="s1xs2", "T1xT2"="s2xs3","T2xT3"="s3xs4","T3xTest"="s4xs5"),TypCel = "Object")
Grp<- Grph.3b(DatP = ExtendDT,"OPR",LblsP =c("Object Exploration", "","Similarity Score"),ylmP =c(-0.5,1.2),hLin = T,lvIp = 4,GrpSel = c(1,3))
names(rrt$DT)[3:6]<-c("T1","T2","T3","T4")
ResGen<-AOVMx2b(A=2,C=4,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
<<ResCtrl5>> #Include here the chunk called ResCtrl3
# Fig 4E Unmoved Controls Global Remapping Unstable Cells {Design 2x(4xS)}
# As Fig.4B
rrt<-ExDataIS.3b(nmF = paste0(PathDesign,"NonMovedControls Final.csv"),Vars = ,c(3,4,12,7:10),vIntP =c(4:7),lvlCh = list("HABxT1"="s1xs2", "T1xT2"="s2xs3","T2xT3"="s3xs4","T3xTest"="s4xs5"),TypCel = "Unstable")
Grp<- Grph.3b(DatP = ExtendDT,"OPR",LblsP =c("Object Exploration", "","Similarity Score"),ylmP =c(-0.5,1.2),hLin = T,lvIp = 4,GrpSel = c(1,3))
names(rrt$DT)[3:6]<-c("T1","T2","T3","T4")
ResGen<-AOVMx2b(A=2,C=4,DatPas = rrt,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
<<ResCtrl5>> #Include here the chunk called ResCtrl3Figure 5. Sleep patterns during post-training and recovery sleep in young and old mice. A-C) Percentage of total time (A), number of bouts (B), and bout length (C) in Wake, NREM, and REM during post-training sleep in young and old control mice. D-F) Percentage of total time (D), number of bouts (E), and bout length (F) in Wake, NREM and REM during recovery sleep in control and SD groups. Young control (n=11), young SD (n=11), old control (n=8), old SD (n=10). Asterisks (*) represent significance using alpha=0.05. Statistical details in Supplemental Statistical Table corresponding to Figure 5.
NmBas="Fig5A_B_C PostL"
NmFich<-paste0(PathDesign,"PostLearn.csv");
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
DatDT <- data.table(read.table(NmFich, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
Nms<-names(DatDT)
Final=ncol(DatDT)
VarsS<-c(3:Final)
NmsSel<-names(DatDT[,VarsS,with=F])
DatDT$Factor<-factor(DatDT$Factor);levels(DatDT$Factor) <- list("Young"="YC", "Old"="OC")
DatDT$Factor<-relevel(DatDT$Factor,"Young")
setkeyv(DatDT,c("Factor"))
ResRo<-list(); rR<-list()
for (i in 3:11) {
ArP<-list()
ArP<-c(lapply(1:2, function (x) na.omit(DatDT[.(levels(DatDT$Factor)[x]),i,with=F][[1]])),recursive = F)
rR[[i-2]]<-AOVSingle(ArP,2)
}
#AOV
rbResRb22<-data.table(NmsSel,do.call(rbind, lapply(rR, as.data.table)))
#MANOVA
NwLst<-list()
NwLst[[1]]<-DatDT[.("Young"),c(3:5),with=F]
NwLst[[2]]<-DatDT[.("Old"),c(3:5),with=F]
ResRo$MANOVA1<-MULAOVp(NwLst,2,3); MULtr.anova(NwLst,2,3)
NwLst[[1]]<-DatDT[.("Young"),c(6:8),with=F]
NwLst[[2]]<-DatDT[.("Old"),c(6:8),with=F]
MULAOVp(NwLst,2,3); MULtr.anova(NwLst,2,3)
ResRo$MANOVA2<-MULAOVp(NwLst,2,3); MULtr.anova(NwLst,2,3)
NwLst[[1]]<-DatDT[.("Young"),c(9:11),with=F]
NwLst[[2]]<-DatDT[.("Old"),c(9:11),with=F]
MULAOVp(NwLst,2,3); MULtr.anova(NwLst,2,3)
ResRo$MANOVA3<-MULAOVp(NwLst,2,3); MULtr.anova(NwLst,2,3)
write.csv2(rbResRb22,paste0(NmFAlL, NmBas,"AllOmnContr.csv"))
ResMANOVA<-data.table(rbind(unlist(ResRo$MANOVA1),unlist(ResRo$MANOVA2),unlist(ResRo$MANOVA3)))
write.csv2(cbind(c("N","Length","Porc"),ResMANOVA),paste0(NmFAlL,NmBas,"AllMANOVA.csv"))
# Graphs
# Fig.5A
NmBas="Fig6A PostL"
DatDTG<-DatDT[,c(1,2,9:11)]
setnames(DatDTG, "Factor", "Age")
DatDTG$Age<-factor(DatDTG$Age);DatDTG$Age<-relevel(DatDTG$Age,"Young")
DatDTG$Subject<-factor(DatDTG$Subject)
setkey(DatDTG,Age)
VIntra=3:5
NmIntra=names(DatDTG[,VIntra,with=F])
ExtendDT<-reshape(DatDTG,direction = "long",varying = list(3:5),idvar = "Subject",
timevar=c("Moment"),times=NmIntra)
colnames(ExtendDT)[4] <- "DepVar"
ExtendDT$Moment<-factor(ExtendDT$Moment)
levels(ExtendDT$Moment) <- list("WAKE"="Porc_Wake", "NREM"="Porc_NREM","REM"="Porc_REM")
ExtendDT$Age<-factor(ExtendDT$Age);ExtendDT$Age<-relevel(ExtendDT$Age,"Young")
ExtendDTRel<-copy(ExtendDT)
names(ExtendDTRel)[2]<-"Group"
Grp<- Grph.3b(DatP = ExtendDTRel,"OPR",LblsP =c("Sleep Patterns", "","Percent Total Time"),ylmP =c(0,80),hLin = F,lvIp = 3,GrpSel = c(1,3))
plot(Grp)
png(paste0(NmFAlL,NmBas,"6A.png"),width = 1200, height = 1000)
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6A.pdf"),family = "ArialMT")
plot(Grp)
dev.off()
# Fig.5B
NmBas="Fig6B PostL"
DatDTG<-DatDT[,c(1:5)]
setnames(DatDTG, "Factor", "Age")
DatDTG$Age<-factor(DatDTG$Age);DatDTG$Age<-relevel(DatDTG$Age,"Young")
DatDTG$Subject<-factor(DatDTG$Subject)
setkey(DatDTG,Age)
VIntra=3:5
NmIntra=names(DatDTG[,VIntra,with=F])
ExtendDT<-reshape(DatDTG,direction = "long",varying = list(3:5),idvar = "Subject",
timevar=c("Moment"),times=NmIntra)
colnames(ExtendDT)[4] <- "DepVar"
ExtendDT$Moment<-factor(ExtendDT$Moment)
levels(ExtendDT$Moment) <- list("WAKE"="N_Wake", "NREM"="N_NREM","REM"="N_REM")
ExtendDT$Age<-factor(ExtendDT$Age);ExtendDT$Age<-relevel(ExtendDT$Age,"Young")
ExtendDTRel<-copy(ExtendDT)
names(ExtendDTRel)[2]<-"Group"
Grp<- Grph.3b(DatP = ExtendDTRel,"OPR",LblsP =c("Sleep Patterns", "","Number of Bouts"),
ylmP =c(0,200),hLin = F,lvIp = 3,GrpSel = c(1,3))
plot(Grp)
levBp<-seq(0.8, 6, by=0.34)
Grp2<- Grp + geom_signif(annotation="*",
y_position=180, xmin=levBp[4] , xmax=levBp[5],
tip_length = c(0.45, 0.02),vjust=0.5,textsize=10)+
geom_signif(annotation="*",
y_position=105, xmin=levBp[7] , xmax=levBp[8],
tip_length = c(0.35, 0.02),vjust=0.5,textsize=10)
plot(Grp2)
png(paste0(NmFAlL,NmBas,"6B.png"),width = 1200, height = 1000)
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6B.pdf"),family = "ArialMT")
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6B_Asterisk.pdf"),family = "ArialMT")
plot(Grp2)
dev.off()
# Fig.5C
NmBas="Fig6C PostL"
DatDTG<-DatDT[,c(1,2,6:8)]
setnames(DatDTG, "Factor", "Age")
DatDTG$Age<-factor(DatDTG$Age);DatDTG$Age<-relevel(DatDTG$Age,"Young")
DatDTG$Subject<-factor(DatDTG$Subject)
setkey(DatDTG,Age)
VIntra=3:5
NmIntra=names(DatDTG[,VIntra,with=F])
ExtendDT<-reshape(DatDTG,direction = "long",varying = list(3:5),idvar = "Subject",
timevar=c("Moment"),times=NmIntra)
colnames(ExtendDT)[4] <- "DepVar"
ExtendDT$Moment<-factor(ExtendDT$Moment)
levels(ExtendDT$Moment) <- list("WAKE"="Length_Wake", "NREM"="Length_NREM","REM"="Length_REM")
ExtendDT$Age<-factor(ExtendDT$Age);ExtendDT$Age<-relevel(ExtendDT$Age,"Young")
ExtendDTRel<-copy(ExtendDT)
names(ExtendDTRel)[2]<-"Group"
Grp<- Grph.3b(DatP = ExtendDTRel,"OPR",LblsP =c("Sleep Patterns", "","Average Bout Length (s)"),
ylmP =c(0,200),hLin = F,lvIp = 3,GrpSel = c(1,3))
plot(Grp)
levBp<-seq(0.8, 6, by=0.34)
Grp2<- Grp + geom_signif(annotation="#",
y_position=125, xmin=levBp[1] , xmax=levBp[2],
tip_length = c(0.02, 0.20),vjust=0,textsize=10)+
geom_signif(annotation="#",
y_position=195, xmin=levBp[4] , xmax=levBp[5],
tip_length = c(0.02, 0.25),vjust=0,textsize=10)
plot(Grp2)
png(paste0(NmFAlL,NmBas,"6C.png"),width = 1200, height = 1000)
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6C.pdf"),family = "ArialMT")
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6C_Asterisk.pdf"),family = "ArialMT")
plot(Grp2)
dev.off()
# Results
rbResRb22
Kbl3(rbResRb22, "Omnibus AOV. Design 2");cat("\n")$test.stat
[1] 77.31751
$crit.value
[1] 13.37283
$test.stat
[1] 9.884484
$p.value
[1] 0.083
$test.stat
[1] 9.884484
$crit.value
[1] 12.06959
$test.stat
[1] 9.884484
$crit.value
[1] 12.06959
$test.stat
[1] 2.598445
$p.value
[1] 0.548
$test.stat
[1] 2.598445
$crit.value
[1] 12.17795
$test.stat
[1] 2.598445
$crit.value
[1] 12.17795
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
NmsSel t
1: N_Wake Diff = -26.33, V(6.75) = 1.37, Eff.Size = 0.74, p = 0.2146
2: N_NREM Diff = -46.81, V(9.23) = 2.84, Eff.Size = 0.74, p = 0.0189
3: N_REM Diff = -39.93, V(8.46) = 2.97, Eff.Size = 0.61, p = 0.0168
4: Length_Wake Diff = 27.6, V(9.85) = 1.92, Eff.Size = 0.64, p = 0.0849
5: Length_NREM Diff = 43.11, V(10.97) = 2.09, Eff.Size = 0.66, p = 0.0607
6: Length_REM Diff = 9.52, V(10.54) = 1.01, Eff.Size = 0.31, p = 0.3368
7: Porc_Wake Diff = 6.91, V(10.33) = 0.91, Eff.Size = 0.32, p = 0.3853
8: Porc_NREM Diff = -3.59, V(10.47) = 0.49, Eff.Size = 0.16, p = 0.6328
9: Porc_REM Diff = -4.36, V(10.28) = 1.42, Eff.Size = 0.35, p = 0.1864
tRk1 t.2.Diff
1: Diff = -26.33, Fw(1,13.48) = 1, Eff.Size = 0.74, p = 0.3357 -26.33
2: Diff = -46.81, Fw(1,14.09) = 7.87, Eff.Size = 0.74, p = 0.014 -46.81
3: Diff = -39.93, Fw(1,14.98) = 3.76, Eff.Size = 0.61, p = 0.0717 -39.93
4: Diff = 27.6, Fw(1,14.37) = 4.71, Eff.Size = 0.64, p = 0.0472 27.60
5: Diff = 43.11, Fw(1,14.92) = 4.55, Eff.Size = 0.66, p = 0.05 43.11
6: Diff = 9.52, Fw(1,14.35) = 1.12, Eff.Size = 0.31, p = 0.308 9.52
7: Diff = 6.91, Fw(1,13.28) = 0.89, Eff.Size = 0.32, p = 0.3612 6.91
8: Diff = -3.59, Fw(1,14.55) = 0.44, Eff.Size = 0.16, p = 0.5198 -3.59
9: Diff = -4.36, Fw(1,14.82) = 1.4, Eff.Size = 0.35, p = 0.2547 -4.36
t.2.DF t.2.FW t.2.Ef.Size t.2.p tRk2.Diff tRk2.DF1 tRk2.DF2 tRk2.Fw
1: 6.75 1.37 0.74 0.2146 -26.33 1 13.48 1.00
2: 9.23 2.84 0.74 0.0189 -46.81 1 14.09 7.87
3: 8.46 2.97 0.61 0.0168 -39.93 1 14.98 3.76
4: 9.85 1.92 0.64 0.0849 27.60 1 14.37 4.71
5: 10.97 2.09 0.66 0.0607 43.11 1 14.92 4.55
6: 10.54 1.01 0.31 0.3368 9.52 1 14.35 1.12
7: 10.33 0.91 0.32 0.3853 6.91 1 13.28 0.89
8: 10.47 0.49 0.16 0.6328 -3.59 1 14.55 0.44
9: 10.28 1.42 0.35 0.1864 -4.36 1 14.82 1.40
tRk2.Ef.Size tRk2.p
1: 0.74 0.3357
2: 0.74 0.0140
3: 0.61 0.0717
4: 0.64 0.0472
5: 0.66 0.0500
6: 0.31 0.3080
7: 0.32 0.3612
8: 0.16 0.5198
9: 0.35 0.2547
| NmsSel | t | tRk1 | t.2.Diff | t.2.DF | t.2.FW | t.2.Ef.Size | t.2.p | tRk2.Diff | tRk2.DF1 | tRk2.DF2 | tRk2.Fw | tRk2.Ef.Size | tRk2.p |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| N_Wake | Diff = -26.33, V(6.75) = 1.37, Eff.Size = 0.74, p = 0.2146 | Diff = -26.33, Fw(1,13.48) = 1, Eff.Size = 0.74, p = 0.3357 | -26.33 | 6.75 | 1.37 | 0.74 | 0.2146 | -26.33 | 1 | 13.48 | 1.00 | 0.74 | 0.3357 |
| N_NREM | Diff = -46.81, V(9.23) = 2.84, Eff.Size = 0.74, p = 0.0189 | Diff = -46.81, Fw(1,14.09) = 7.87, Eff.Size = 0.74, p = 0.014 | -46.81 | 9.23 | 2.84 | 0.74 | 0.0189 | -46.81 | 1 | 14.09 | 7.87 | 0.74 | 0.0140 |
| N_REM | Diff = -39.93, V(8.46) = 2.97, Eff.Size = 0.61, p = 0.0168 | Diff = -39.93, Fw(1,14.98) = 3.76, Eff.Size = 0.61, p = 0.0717 | -39.93 | 8.46 | 2.97 | 0.61 | 0.0168 | -39.93 | 1 | 14.98 | 3.76 | 0.61 | 0.0717 |
| Length_Wake | Diff = 27.6, V(9.85) = 1.92, Eff.Size = 0.64, p = 0.0849 | Diff = 27.6, Fw(1,14.37) = 4.71, Eff.Size = 0.64, p = 0.0472 | 27.60 | 9.85 | 1.92 | 0.64 | 0.0849 | 27.60 | 1 | 14.37 | 4.71 | 0.64 | 0.0472 |
| Length_NREM | Diff = 43.11, V(10.97) = 2.09, Eff.Size = 0.66, p = 0.0607 | Diff = 43.11, Fw(1,14.92) = 4.55, Eff.Size = 0.66, p = 0.05 | 43.11 | 10.97 | 2.09 | 0.66 | 0.0607 | 43.11 | 1 | 14.92 | 4.55 | 0.66 | 0.0500 |
| Length_REM | Diff = 9.52, V(10.54) = 1.01, Eff.Size = 0.31, p = 0.3368 | Diff = 9.52, Fw(1,14.35) = 1.12, Eff.Size = 0.31, p = 0.308 | 9.52 | 10.54 | 1.01 | 0.31 | 0.3368 | 9.52 | 1 | 14.35 | 1.12 | 0.31 | 0.3080 |
| Porc_Wake | Diff = 6.91, V(10.33) = 0.91, Eff.Size = 0.32, p = 0.3853 | Diff = 6.91, Fw(1,13.28) = 0.89, Eff.Size = 0.32, p = 0.3612 | 6.91 | 10.33 | 0.91 | 0.32 | 0.3853 | 6.91 | 1 | 13.28 | 0.89 | 0.32 | 0.3612 |
| Porc_NREM | Diff = -3.59, V(10.47) = 0.49, Eff.Size = 0.16, p = 0.6328 | Diff = -3.59, Fw(1,14.55) = 0.44, Eff.Size = 0.16, p = 0.5198 | -3.59 | 10.47 | 0.49 | 0.16 | 0.6328 | -3.59 | 1 | 14.55 | 0.44 | 0.16 | 0.5198 |
| Porc_REM | Diff = -4.36, V(10.28) = 1.42, Eff.Size = 0.35, p = 0.1864 | Diff = -4.36, Fw(1,14.82) = 1.4, Eff.Size = 0.35, p = 0.2547 | -4.36 | 10.28 | 1.42 | 0.35 | 0.1864 | -4.36 | 1 | 14.82 | 1.40 | 0.35 | 0.2547 |
NmBas="Fig6D_E_F Recovery"
NmFich<-paste0(PathDesign,"RecoverSleep.csv");
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
DatDT <- data.table(read.table(NmFich, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
Nms<-names(DatDT)
Final=ncol(DatDT)
VarsS<-c(4:Final)
NmsSel<-names(DatDT[,VarsS,with=F])
setnames(DatDT, "FactorA", "Age")
setnames(DatDT, "FactorB", "Sleep")
setnames(DatDT, "subject", "Subject")
DatDT$Age<-factor(DatDT$Age);levels(DatDT$Age) <- list("Young"="y", "Old"="O")
DatDT$Age<-relevel(DatDT$Age,"Young")
DatDT$Sleep<-factor(DatDT$Sleep);levels(DatDT$Sleep) <- list("Control"="C", "SR"="SD")
DatDT$Sleep<-relevel(DatDT$Sleep,"Control")
DatDT$Subject<-factor(DatDT$Subject)
setkey(DatDT,Age,Sleep)
ResRo<-list()
ResRo2AOV<-ResRo2Detall<-ResRo2DetallExt<-list()
i=4
for (i in 4:12) {
rrt<-list()
VarSel<-c(2,3,i)
rrt$DT<-DatDT[,..VarSel]
ArP<-unlist(lapply(1:2, function (x) lapply(1:2, function(y) DatDT[.(levels(DatDT$Age)[x],levels(DatDT$Sleep)[y]),i,with=F][[1]])),recursive = F)
rrt$ArP<-ArP
names(rrt$DT)[3]<-"DepV"
ResRo2<-AOVBwF(2,2,DatPas = rrt,nBMM = 1000)
ResRo2AOV[[i-3]]<-ResRo2$AOV
ResRo2Detall[[i-3]]<-ResRo2$Detall
ResRo2DetallExt[[i-3]]<-ResRo2$DetallExt
}
rbResRb23AOV<-data.table(NmsSel,do.call(rbind, lapply(ResRo2AOV, as.data.table)))
rbResRb23Detall<-data.table(NmsSel,do.call(rbind, lapply(ResRo2Detall, as.data.table)))
rbResRb23DetallExt<-data.table(NmsSel,do.call(rbind, lapply(ResRo2DetallExt, as.data.table)))
write.csv2(rbResRb23AOV,paste0(NmFAlL,NmBas,"AllAOV.csv"))
write.csv2(rbResRb23Detall,paste0(NmFAlL,NmBas,"AllDetallContr.csv"))
write.csv2(rbResRb23DetallExt,paste0(NmFAlL,NmBas,"AllDetallExtContr.csv"))
# Graphs
# Fig.5D
NmBas="Fig6D Recovery"
DatDTG<-DatDT[,c(1,2,3,10:12)]
VIntra=4:6
NmIntra=names(DatDTG[,VIntra,with=F])
ExtendDT<-reshape(DatDTG,direction = "long",varying = list(4:6),idvar = "Subject",
timevar=c("Moment"),times=NmIntra)
colnames(ExtendDT)[5] <- "DepVar"
ExtendDT$Moment<-factor(ExtendDT$Moment)
levels(ExtendDT$Moment) <- list("WAKE"="Porc_Wake", "NREM"="Porc_NREM","REM"="Porc_REM")
ExtendDT$Age<-factor(ExtendDT$Age);ExtendDT$Age<-relevel(ExtendDT$Age,"Young")
ExtendDT$Sleep<-factor(ExtendDT$Sleep);ExtendDT$Sleep<-relevel(ExtendDT$Sleep,"Control")
ExtendDT$Inter<-interaction(ExtendDT$Age,ExtendDT$Sleep)
ExtendDT$Inter<-factor( ExtendDT$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Sleep Patterns", "","Percent Total Time"),ylmP =c(0,80),hLin = F,lvIp = 3)
plot(Grp)
levBp<-seq(0.7, 5, by=0.2)
Grp2<- Grp + geom_signif(annotation=c("","","*"),
y_position=c(75,77,79),
xmin=c(levBp[1+5],levBp[2+5], mean(levBp[c(1+5,2+5)])),
xmax=c(levBp[3+5],levBp[4+5], mean(levBp[c(2+5,4+5)])),
tip_length = c(c(0.02, 0.02),c(0.02, 0.02),c(0.05, 0.02)),vjust=0.5,textsize=10)
plot(Grp2)
png(paste0(NmFAlL,NmBas,"6D.png"),width = 1200, height = 1000)
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6D.pdf"),family = "ArialMT")
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6D_Asterisk.pdf"),family = "ArialMT")
plot(Grp2)
dev.off()
# Fig.5E
NmBas="Fig6E Recovery"
DatDTG<-DatDT[,c(1,2,3,4:6)]
VIntra=4:6
NmIntra=names(DatDTG[,VIntra,with=F])
ExtendDT<-reshape(DatDTG,direction = "long",varying = list(4:6),idvar = "Subject",
timevar=c("Moment"),times=NmIntra)
colnames(ExtendDT)[5] <- "DepVar"
ExtendDT$Moment<-factor(ExtendDT$Moment)
levels(ExtendDT$Moment) <- list("WAKE"="N_Wake", "NREM"="N_NREM","REM"="N_REM")
ExtendDT$Age<-factor(ExtendDT$Age);ExtendDT$Age<-relevel(ExtendDT$Age,"Young")
ExtendDT$Sleep<-factor(ExtendDT$Sleep);ExtendDT$Sleep<-relevel(ExtendDT$Sleep,"Control")
ExtendDT$Inter<-interaction(ExtendDT$Age,ExtendDT$Sleep)
ExtendDT$Inter<-factor( ExtendDT$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Sleep Patterns", "","Number of Bouts"),ylmP =c(0,200),hLin = F,lvIp = 3)
plot(Grp)
levBp<-seq(0.7, 5, by=0.2)
Grp2<- Grp + geom_signif(annotation="*",
y_position=195, xmin=levBp[3+5] , xmax=levBp[4+5],
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10) +
geom_signif(annotation="#",
y_position=180, xmin=levBp[2+5] , xmax=levBp[4+5],
tip_length = c(0.02, 0.02),vjust=0,textsize=8)
plot(Grp2)
png(paste0(NmFAlL,NmBas,"6D.png"),width = 1200, height = 1000)
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6D.pdf"),family = "ArialMT")
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6D_Asterisk.pdf"),family = "ArialMT")
plot(Grp2)
dev.off()
# Fig.5F
NmBas="Fig6F Recovery"
DatDTG<-DatDT[,c(1,2,3,7:9)]
VIntra=4:6
NmIntra=names(DatDTG[,VIntra,with=F])
ExtendDT<-reshape(DatDTG,direction = "long",varying = list(4:6),idvar = "Subject",
timevar=c("Moment"),times=NmIntra)
colnames(ExtendDT)[5] <- "DepVar"
ExtendDT$Moment<-factor(ExtendDT$Moment)
levels(ExtendDT$Moment) <- list("WAKE"="Length_Wake", "NREM"="Length_NREM","REM"="Length_REM")
ExtendDT$Age<-factor(ExtendDT$Age);ExtendDT$Age<-relevel(ExtendDT$Age,"Young")
ExtendDT$Sleep<-factor(ExtendDT$Sleep);ExtendDT$Sleep<-relevel(ExtendDT$Sleep,"Control")
ExtendDT$Inter<-interaction(ExtendDT$Age,ExtendDT$Sleep)
ExtendDT$Inter<-factor( ExtendDT$Inter,levels=c("Young.Control", "Young.SR", "Old.Control","Old.SR"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Sleep Patterns", "","Average Bout Length (s)"),ylmP =c(0,200),hLin = F,lvIp = 3)
plot(Grp)
levBp<-seq(0.7, 5, by=0.2)
Grp2<- Grp + geom_signif(annotation=c("","","*"),
y_position=c(185,195,200),
xmin=c(levBp[1+5],levBp[2+5], mean(levBp[c(1+5,2+5)])),
xmax=c(levBp[3+5],levBp[4+5], mean(levBp[c(2+5,4+5)])),
tip_length = c(c(0.10, 0.10),c(0.02, 0.02),c(0.05, 0.02)),vjust=0.5,textsize=10)
plot(Grp2)
png(paste0(NmFAlL,NmBas,"6D.png"),width = 1200, height = 1000)
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6D.pdf"),family = "ArialMT")
plot(Grp)
dev.off()
pdf(paste0(NmFAlL,NmBas,"6D_Asterisk.pdf"),family = "ArialMT")
plot(Grp2)
dev.off()
# Results
rbResRb23AOV #Omnibus AOV. Design 2x2"
rbResRb23Detall #Simple Effects Age-Sleep. Design 2x2
rbResRb23DetallExt # Extense Simple Effects Age-Sleep. Design 2x2
Kbl3(rbResRb23AOV, "Omnibus AOV. Design 2x2");cat("\n")
Kbl3(rbResRb23Detall, "Simple Effects Age-Sleep. Design 2x2")
Kbl3(rbResRb23DetallExt, "Extense Simple Effects Age-Sleep. Design 2x2")[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.2922
2: B.p.value 0.1870
3: AB.p.value NA
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.301
2: B.p.value 0.146
3: AB.p.value 0.984
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.2755
2: B.p.value 0.0467 *
3: AB.p.value 0.4992
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.300
2: B.p.value 0.037 *
3: AB.p.value 0.578
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.5409
2: B.p.value 0.8798
3: AB.p.value NA
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.529
2: B.p.value 0.886
3: AB.p.value 0.148
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.5492
2: B.p.value 0.9316
3: AB.p.value NA
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.512
2: B.p.value 0.905
3: AB.p.value 0.646
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.6678
2: B.p.value 0.0200 *
3: AB.p.value 0.4524
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.663
2: B.p.value 0.021 *
3: AB.p.value 0.981
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.2705
2: B.p.value 0.0467 *
3: AB.p.value 0.1302
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.243
2: B.p.value 0.046 *
3: AB.p.value 0.088
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.5526
2: B.p.value 0.0952
3: AB.p.value 0.9065
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.572
2: B.p.value 0.083
3: AB.p.value 0.787
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.7696
2: B.p.value 0.0401 *
3: AB.p.value 0.5760
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.779
2: B.p.value 0.033 *
3: AB.p.value 0.638
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.4107
2: B.p.value 0.3656
3: AB.p.value 0.8781
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.357
2: B.p.value 0.382
3: AB.p.value 0.769
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
NmsSel Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig
1: N_Wake Age 1.22 0.283 1.22 0.283 1.19 0.2830 0.2922
2: N_NREM Sleep 1.99 0.175 1.99 0.175 1.34 0.2558 0.1870
3: N_REM Age*Sleep 0.00 0.988 -0.04 0.820 0.00 0.9524 NA
4: Length_Wake Age 1.06 0.321 1.06 0.321 2.69 0.1105 0.2755
5: Length_NREM Sleep 5.33 0.035 5.33 0.035 11.47 0.0019 0.0467 *
6: Length_REM Age*Sleep 0.30 0.595 0.32 0.030 2.66 0.1128 0.4992
7: Porc_Wake Age 0.40 0.538 0.40 0.538 0.36 0.5547 0.5409
8: Porc_NREM Sleep 0.02 0.884 0.02 0.884 0.12 0.7270 0.8798
9: Porc_REM Age*Sleep 2.26 0.149 -0.36 0.050 3.66 0.0649 NA
10: N_Wake Age 0.40 0.535 0.40 0.535 0.13 0.7250 0.5492
11: N_NREM Sleep 0.02 0.899 0.02 0.899 0.01 0.9115 0.9316
12: N_REM Age*Sleep 0.20 0.663 0.01 0.970 0.02 0.8929 NA
13: Length_Wake Age 0.16 0.690 0.16 0.690 0.30 0.5877 0.6678
14: Length_NREM Sleep 7.53 0.013 7.53 0.013 10.44 0.0028 0.0200 *
15: Length_REM Age*Sleep 0.00 0.983 -0.06 0.730 0.22 0.6441 0.4524
16: Porc_Wake Age 1.36 0.258 1.36 0.258 0.99 0.3283 0.2705
17: Porc_NREM Sleep 4.19 0.054 4.19 0.054 3.12 0.0886 0.0467 *
18: Porc_REM Age*Sleep 3.21 0.089 0.34 0.060 3.41 0.0758 0.1302
19: N_Wake Age 0.33 0.574 0.33 0.574 0.35 0.5573 0.5526
20: N_NREM Sleep 3.02 0.099 3.02 0.099 3.62 0.0653 0.0952
21: N_REM Age*Sleep 0.08 0.777 0.03 0.850 0.03 0.8532 0.9065
22: Length_Wake Age 0.09 0.765 0.09 0.765 0.00 0.9862 0.7696
23: Length_NREM Sleep 4.65 0.048 4.65 0.048 7.73 0.0087 0.0401 *
24: Length_REM Age*Sleep 0.23 0.638 -0.06 0.740 0.02 0.8766 0.5760
25: Porc_Wake Age 0.84 0.369 0.84 0.369 1.21 0.2785 0.4107
26: Porc_NREM Sleep 0.76 0.392 0.76 0.392 1.00 0.3241 0.3656
27: Porc_REM Age*Sleep 0.09 0.771 -0.08 0.690 0.30 0.5855 0.8781
NmsSel Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig
pBootMas SigMas EffSize
1: 0.301 0.20
2: 0.146 0.24
3: 0.984 0.03
4: 0.300 0.39
5: 0.037 * 0.54
6: 0.578 0.30
7: 0.529 0.16
8: 0.886 0.07
9: 0.148 0.60
10: 0.512 0.14
11: 0.905 0.06
12: 0.646 0.10
13: 0.663 0.25
14: 0.021 * 0.62
15: 0.981 0.09
16: 0.243 0.27
17: 0.046 * 0.43
18: 0.088 0.57
19: 0.572 0.07
20: 0.083 0.42
21: 0.787 0.09
22: 0.779 0.05
23: 0.033 * 0.36
24: 0.638 0.07
25: 0.357 0.23
26: 0.382 0.16
27: 0.769 0.17
pBootMas SigMas EffSize
NmsSel Contr psihat df test p.value EfSize.V1 Test.Boot
1: N_Wake Sleep on Young 19.57 9.92 1.20 0.2581 0.32 1.44
2: N_NREM Sleep on Old 20.00 9.80 0.88 0.4019 0.12 0.77
3: N_REM Age on Control -15.74 10.07 -0.71 0.4940 0.19 0.50
4: Length_Wake Age on SR -15.31 8.05 -0.89 0.3989 0.25 0.79
5: Length_NREM Sleep on Young 23.71 8.88 1.03 0.3281 0.30 1.07
6: Length_REM Sleep on Old 38.33 5.66 2.73 0.0361 0.81 7.48
7: Porc_Wake Age on Control 6.50 10.10 0.26 0.7965 0.17 0.07
8: Porc_NREM Age on SR 21.12 7.33 1.94 0.0923 0.59 3.75
9: Porc_REM Sleep on Young 16.86 9.56 1.41 0.1911 0.52 1.98
10: N_Wake Sleep on Old -13.83 9.83 -0.84 0.4221 0.32 0.70
11: N_NREM Age on Control 8.93 10.79 0.59 0.5653 0.25 0.35
12: N_REM Age on SR -21.76 7.25 -1.58 0.1566 0.58 2.50
13: Length_Wake Sleep on Young -4.32 10.03 -0.18 0.8586 0.07 0.03
14: Length_NREM Sleep on Old 7.88 9.97 0.57 0.5832 0.10 0.32
15: Length_REM Age on Control 2.59 10.84 0.16 0.8747 0.11 0.03
16: Porc_Wake Age on SR 14.79 8.50 0.66 0.5239 0.26 0.44
17: Porc_NREM Sleep on Young -45.20 11.98 -1.86 0.0873 0.53 3.47
18: Porc_REM Sleep on Old -45.92 7.26 -2.03 0.0809 0.91 4.10
19: N_Wake Age on Control -6.38 10.21 -0.24 0.8142 0.09 0.06
20: N_NREM Age on SR -7.10 9.35 -0.35 0.7320 0.11 0.12
21: N_REM Sleep on Young -12.54 10.25 -2.67 0.0232 0.67 7.11
22: Length_Wake Sleep on Old -0.84 8.71 -0.19 0.8572 0.09 0.03
23: Length_NREM Age on Control -2.04 9.03 -0.45 0.6653 0.14 0.20
24: Length_REM Age on SR 9.66 9.89 2.06 0.0665 0.60 4.25
25: Porc_Wake Sleep on Young 3.91 10.73 1.14 0.2788 0.32 1.30
26: Porc_NREM Sleep on Old 5.46 8.20 1.31 0.2247 0.59 1.72
27: Porc_REM Age on Control -2.32 9.95 -0.51 0.6198 0.13 0.26
28: N_Wake Age on SR -0.77 10.66 -0.27 0.7957 0.10 0.07
29: N_NREM Sleep on Young -5.73 12.00 -1.54 0.1490 0.42 2.38
30: N_REM Sleep on Old -9.04 7.57 -1.57 0.1568 0.37 2.47
31: Length_Wake Age on Control 2.70 7.55 0.47 0.6506 0.18 0.22
32: Length_NREM Age on SR -0.60 10.88 -0.16 0.8752 0.06 0.03
33: Length_REM Sleep on Young 1.76 11.99 0.78 0.4479 0.24 0.62
34: Porc_Wake Sleep on Old 0.87 9.56 0.43 0.6746 0.11 0.19
35: Porc_NREM Age on Control 1.82 10.91 0.82 0.4277 0.30 0.68
36: Porc_REM Age on SR 0.94 10.77 0.46 0.6548 0.13 0.21
NmsSel Contr psihat df test p.value EfSize.V1 Test.Boot
p.Boot EffSize.Boot
1: 0.2489 0.32
2: 0.3956 0.16
3: 0.4778 0.19
4: 0.3878 0.25
5: 0.3122 0.30
6: 0.0744 0.81
7: 0.7786 0.16
8: 0.0811 0.59
9: 0.1856 0.52
10: 0.4332 0.32
11: 0.5929 0.26
12: 0.1507 0.59
13: 0.8644 0.07
14: 0.5795 0.13
15: 0.9022 0.12
16: 0.5378 0.27
17: 0.1000 0.53
18: 0.0978 0.91
19: 0.8053 0.09
20: 0.7167 0.06
21: 0.0300 0.67
22: 0.8589 0.09
23: 0.6656 0.18
24: 0.0778 0.65
25: 0.2678 0.32
26: 0.2299 0.62
27: 0.6344 0.13
28: 0.7935 0.09
29: 0.1122 0.42
30: 0.1508 0.39
31: 0.6689 0.22
32: 0.8756 0.08
33: 0.4544 0.24
34: 0.6811 0.10
35: 0.4109 0.31
36: 0.6085 0.13
p.Boot EffSize.Boot
NmsSel Contr psihat df test p.value EfSize.V1 Test.Boot
1: N_Wake Sleep on Young 19.57 9.92 1.20 0.2581 0.32 1.44
2: N_NREM Sleep on Old 20.00 9.80 0.88 0.4019 0.22 0.77
3: N_REM Age on Control -15.74 10.07 -0.71 0.4940 0.19 0.50
4: Length_Wake Age on SR -15.31 8.05 -0.89 0.3989 0.25 0.79
5: Length_NREM YSR vs OC -35.31 7.36 -1.84 0.1070 0.41 3.37
6: Length_REM Sleep on Young 23.71 8.88 1.03 0.3281 0.30 1.07
7: Porc_Wake Sleep on Old 38.33 5.66 2.73 0.0361 0.79 7.48
8: Porc_NREM Age on Control 6.50 10.10 0.26 0.7965 0.18 0.07
9: Porc_REM Age on SR 21.12 7.33 1.94 0.0923 0.59 3.75
10: N_Wake YSR vs OC -17.21 9.75 -1.01 0.3375 0.23 1.02
11: N_NREM Sleep on Young 16.86 9.56 1.41 0.1911 0.52 1.98
12: N_REM Sleep on Old -13.83 9.83 -0.84 0.4221 0.38 0.70
13: Length_Wake Age on Control 8.93 10.79 0.59 0.5653 0.22 0.35
14: Length_NREM Age on SR -21.76 7.25 -1.58 0.1566 0.58 2.50
15: Length_REM YSR vs OC -7.93 7.86 -0.64 0.5412 0.23 0.41
16: Porc_Wake Sleep on Young -4.32 10.03 -0.18 0.8586 0.07 0.03
17: Porc_NREM Sleep on Old 7.88 9.97 0.57 0.5832 0.10 0.32
18: Porc_REM Age on Control 2.59 10.84 0.16 0.8747 0.12 0.03
19: N_Wake Age on SR 14.79 8.50 0.66 0.5239 0.27 0.44
20: N_NREM YSR vs OC 6.91 8.74 0.31 0.7657 0.22 0.09
21: N_REM Sleep on Young -45.20 11.98 -1.86 0.0873 0.53 3.47
22: Length_Wake Sleep on Old -45.92 7.26 -2.03 0.0809 0.91 4.10
23: Length_NREM Age on Control -6.38 10.21 -0.24 0.8142 0.09 0.06
24: Length_REM Age on SR -7.10 9.35 -0.35 0.7320 0.11 0.12
25: Porc_Wake YSR vs OC 38.83 10.38 1.45 0.1774 0.52 2.09
26: Porc_NREM Sleep on Young -12.54 10.25 -2.67 0.0232 0.67 7.11
27: Porc_REM Sleep on Old -0.84 8.71 -0.19 0.8572 0.09 0.03
28: N_Wake Age on Control -2.04 9.03 -0.45 0.6653 0.14 0.20
29: N_NREM Age on SR 9.66 9.89 2.06 0.0665 0.60 4.25
30: N_REM YSR vs OC 10.50 10.98 1.92 0.0810 0.56 3.69
31: Length_Wake Sleep on Young 3.91 10.73 1.14 0.2788 0.32 1.30
32: Length_NREM Sleep on Old 5.46 8.20 1.31 0.2247 0.59 1.72
33: Length_REM Age on Control -2.32 9.95 -0.51 0.6198 0.13 0.26
34: Porc_Wake Age on SR -0.77 10.66 -0.27 0.7957 0.09 0.07
35: Porc_NREM YSR vs OC -6.23 7.89 -1.53 0.1646 0.62 2.35
36: Porc_REM Sleep on Young -5.73 12.00 -1.54 0.1490 0.42 2.38
37: N_Wake Sleep on Old -9.04 7.57 -1.57 0.1568 0.38 2.47
38: N_NREM Age on Control 2.70 7.55 0.47 0.6506 0.18 0.22
39: N_REM Age on SR -0.60 10.88 -0.16 0.8752 0.04 0.03
40: Length_Wake YSR vs OC 8.43 7.60 1.47 0.1816 0.39 2.16
41: Length_NREM Sleep on Young 1.76 11.99 0.78 0.4479 0.24 0.62
42: Length_REM Sleep on Old 0.87 9.56 0.43 0.6746 0.09 0.19
43: Porc_Wake Age on Control 1.82 10.91 0.82 0.4277 0.29 0.68
44: Porc_NREM Age on SR 0.94 10.77 0.46 0.6548 0.13 0.21
45: Porc_REM YSR vs OC 0.07 10.95 0.03 0.9768 0.09 0.00
NmsSel Contr psihat df test p.value EfSize.V1 Test.Boot
p.Boot EffSize.Boot
1: 0.2411 0.32
2: 0.3915 0.17
3: 0.4978 0.21
4: 0.4022 0.25
5: 0.1123 0.42
6: 0.3311 0.30
7: 0.0523 0.81
8: 0.7689 0.18
9: 0.1100 0.59
10: 0.3593 0.22
11: 0.1956 0.52
12: 0.4538 0.32
13: 0.5678 0.24
14: 0.1682 0.58
15: 0.5484 0.20
16: 0.8478 0.07
17: 0.5522 0.13
18: 0.8789 0.11
19: 0.5706 0.26
20: 0.7887 0.30
21: 0.0878 0.53
22: 0.1078 0.91
23: 0.8011 0.10
24: 0.7056 0.09
25: 0.1947 0.52
26: 0.0267 0.67
27: 0.8600 0.08
28: 0.6767 0.11
29: 0.0778 0.65
30: 0.0723 0.58
31: 0.2656 0.32
32: 0.2383 0.61
33: 0.6333 0.17
34: 0.8020 0.09
35: 0.1735 0.64
36: 0.1533 0.42
37: 0.1609 0.37
38: 0.6589 0.16
39: 0.8808 0.08
40: 0.1846 0.39
41: 0.4578 0.24
42: 0.6719 0.12
43: 0.3904 0.29
44: 0.6211 0.13
45: 0.9744 0.11
p.Boot EffSize.Boot
| NmsSel | Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| N_Wake | Age | 1.22 | 0.283 | 1.22 | 0.283 | 1.19 | 0.2830 | 0.2922 | 0.301 | 0.20 | ||
| N_NREM | Sleep | 1.99 | 0.175 | 1.99 | 0.175 | 1.34 | 0.2558 | 0.1870 | 0.146 | 0.24 | ||
| N_REM | Age*Sleep | 0.00 | 0.988 | -0.04 | 0.820 | 0.00 | 0.9524 | NA | 0.984 | 0.03 | ||
| Length_Wake | Age | 1.06 | 0.321 | 1.06 | 0.321 | 2.69 | 0.1105 | 0.2755 | 0.300 | 0.39 | ||
| Length_NREM | Sleep | 5.33 | 0.035 | 5.33 | 0.035 | 11.47 | 0.0019 | 0.0467 |
|
0.037 |
|
0.54 |
| Length_REM | Age*Sleep | 0.30 | 0.595 | 0.32 | 0.030 | 2.66 | 0.1128 | 0.4992 | 0.578 | 0.30 | ||
| Porc_Wake | Age | 0.40 | 0.538 | 0.40 | 0.538 | 0.36 | 0.5547 | 0.5409 | 0.529 | 0.16 | ||
| Porc_NREM | Sleep | 0.02 | 0.884 | 0.02 | 0.884 | 0.12 | 0.7270 | 0.8798 | 0.886 | 0.07 | ||
| Porc_REM | Age*Sleep | 2.26 | 0.149 | -0.36 | 0.050 | 3.66 | 0.0649 | NA | 0.148 | 0.60 | ||
| N_Wake | Age | 0.40 | 0.535 | 0.40 | 0.535 | 0.13 | 0.7250 | 0.5492 | 0.512 | 0.14 | ||
| N_NREM | Sleep | 0.02 | 0.899 | 0.02 | 0.899 | 0.01 | 0.9115 | 0.9316 | 0.905 | 0.06 | ||
| N_REM | Age*Sleep | 0.20 | 0.663 | 0.01 | 0.970 | 0.02 | 0.8929 | NA | 0.646 | 0.10 | ||
| Length_Wake | Age | 0.16 | 0.690 | 0.16 | 0.690 | 0.30 | 0.5877 | 0.6678 | 0.663 | 0.25 | ||
| Length_NREM | Sleep | 7.53 | 0.013 | 7.53 | 0.013 | 10.44 | 0.0028 | 0.0200 |
|
0.021 |
|
0.62 |
| Length_REM | Age*Sleep | 0.00 | 0.983 | -0.06 | 0.730 | 0.22 | 0.6441 | 0.4524 | 0.981 | 0.09 | ||
| Porc_Wake | Age | 1.36 | 0.258 | 1.36 | 0.258 | 0.99 | 0.3283 | 0.2705 | 0.243 | 0.27 | ||
| Porc_NREM | Sleep | 4.19 | 0.054 | 4.19 | 0.054 | 3.12 | 0.0886 | 0.0467 |
|
0.046 |
|
0.43 |
| Porc_REM | Age*Sleep | 3.21 | 0.089 | 0.34 | 0.060 | 3.41 | 0.0758 | 0.1302 | 0.088 | 0.57 | ||
| N_Wake | Age | 0.33 | 0.574 | 0.33 | 0.574 | 0.35 | 0.5573 | 0.5526 | 0.572 | 0.07 | ||
| N_NREM | Sleep | 3.02 | 0.099 | 3.02 | 0.099 | 3.62 | 0.0653 | 0.0952 | 0.083 | 0.42 | ||
| N_REM | Age*Sleep | 0.08 | 0.777 | 0.03 | 0.850 | 0.03 | 0.8532 | 0.9065 | 0.787 | 0.09 | ||
| Length_Wake | Age | 0.09 | 0.765 | 0.09 | 0.765 | 0.00 | 0.9862 | 0.7696 | 0.779 | 0.05 | ||
| Length_NREM | Sleep | 4.65 | 0.048 | 4.65 | 0.048 | 7.73 | 0.0087 | 0.0401 |
|
0.033 |
|
0.36 |
| Length_REM | Age*Sleep | 0.23 | 0.638 | -0.06 | 0.740 | 0.02 | 0.8766 | 0.5760 | 0.638 | 0.07 | ||
| Porc_Wake | Age | 0.84 | 0.369 | 0.84 | 0.369 | 1.21 | 0.2785 | 0.4107 | 0.357 | 0.23 | ||
| Porc_NREM | Sleep | 0.76 | 0.392 | 0.76 | 0.392 | 1.00 | 0.3241 | 0.3656 | 0.382 | 0.16 | ||
| Porc_REM | Age*Sleep | 0.09 | 0.771 | -0.08 | 0.690 | 0.30 | 0.5855 | 0.8781 | 0.769 | 0.17 |
| NmsSel | Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|---|
| N_Wake | Sleep on Young | 19.57 | 9.92 | 1.20 | 0.2581 | 0.32 | 1.44 | 0.2489 | 0.32 |
| N_NREM | Sleep on Old | 20.00 | 9.80 | 0.88 | 0.4019 | 0.12 | 0.77 | 0.3956 | 0.16 |
| N_REM | Age on Control | -15.74 | 10.07 | -0.71 | 0.4940 | 0.19 | 0.50 | 0.4778 | 0.19 |
| Length_Wake | Age on SR | -15.31 | 8.05 | -0.89 | 0.3989 | 0.25 | 0.79 | 0.3878 | 0.25 |
| Length_NREM | Sleep on Young | 23.71 | 8.88 | 1.03 | 0.3281 | 0.30 | 1.07 | 0.3122 | 0.30 |
| Length_REM | Sleep on Old | 38.33 | 5.66 | 2.73 | 0.0361 | 0.81 | 7.48 | 0.0744 | 0.81 |
| Porc_Wake | Age on Control | 6.50 | 10.10 | 0.26 | 0.7965 | 0.17 | 0.07 | 0.7786 | 0.16 |
| Porc_NREM | Age on SR | 21.12 | 7.33 | 1.94 | 0.0923 | 0.59 | 3.75 | 0.0811 | 0.59 |
| Porc_REM | Sleep on Young | 16.86 | 9.56 | 1.41 | 0.1911 | 0.52 | 1.98 | 0.1856 | 0.52 |
| N_Wake | Sleep on Old | -13.83 | 9.83 | -0.84 | 0.4221 | 0.32 | 0.70 | 0.4332 | 0.32 |
| N_NREM | Age on Control | 8.93 | 10.79 | 0.59 | 0.5653 | 0.25 | 0.35 | 0.5929 | 0.26 |
| N_REM | Age on SR | -21.76 | 7.25 | -1.58 | 0.1566 | 0.58 | 2.50 | 0.1507 | 0.59 |
| Length_Wake | Sleep on Young | -4.32 | 10.03 | -0.18 | 0.8586 | 0.07 | 0.03 | 0.8644 | 0.07 |
| Length_NREM | Sleep on Old | 7.88 | 9.97 | 0.57 | 0.5832 | 0.10 | 0.32 | 0.5795 | 0.13 |
| Length_REM | Age on Control | 2.59 | 10.84 | 0.16 | 0.8747 | 0.11 | 0.03 | 0.9022 | 0.12 |
| Porc_Wake | Age on SR | 14.79 | 8.50 | 0.66 | 0.5239 | 0.26 | 0.44 | 0.5378 | 0.27 |
| Porc_NREM | Sleep on Young | -45.20 | 11.98 | -1.86 | 0.0873 | 0.53 | 3.47 | 0.1000 | 0.53 |
| Porc_REM | Sleep on Old | -45.92 | 7.26 | -2.03 | 0.0809 | 0.91 | 4.10 | 0.0978 | 0.91 |
| N_Wake | Age on Control | -6.38 | 10.21 | -0.24 | 0.8142 | 0.09 | 0.06 | 0.8053 | 0.09 |
| N_NREM | Age on SR | -7.10 | 9.35 | -0.35 | 0.7320 | 0.11 | 0.12 | 0.7167 | 0.06 |
| N_REM | Sleep on Young | -12.54 | 10.25 | -2.67 | 0.0232 | 0.67 | 7.11 | 0.0300 | 0.67 |
| Length_Wake | Sleep on Old | -0.84 | 8.71 | -0.19 | 0.8572 | 0.09 | 0.03 | 0.8589 | 0.09 |
| Length_NREM | Age on Control | -2.04 | 9.03 | -0.45 | 0.6653 | 0.14 | 0.20 | 0.6656 | 0.18 |
| Length_REM | Age on SR | 9.66 | 9.89 | 2.06 | 0.0665 | 0.60 | 4.25 | 0.0778 | 0.65 |
| Porc_Wake | Sleep on Young | 3.91 | 10.73 | 1.14 | 0.2788 | 0.32 | 1.30 | 0.2678 | 0.32 |
| Porc_NREM | Sleep on Old | 5.46 | 8.20 | 1.31 | 0.2247 | 0.59 | 1.72 | 0.2299 | 0.62 |
| Porc_REM | Age on Control | -2.32 | 9.95 | -0.51 | 0.6198 | 0.13 | 0.26 | 0.6344 | 0.13 |
| N_Wake | Age on SR | -0.77 | 10.66 | -0.27 | 0.7957 | 0.10 | 0.07 | 0.7935 | 0.09 |
| N_NREM | Sleep on Young | -5.73 | 12.00 | -1.54 | 0.1490 | 0.42 | 2.38 | 0.1122 | 0.42 |
| N_REM | Sleep on Old | -9.04 | 7.57 | -1.57 | 0.1568 | 0.37 | 2.47 | 0.1508 | 0.39 |
| Length_Wake | Age on Control | 2.70 | 7.55 | 0.47 | 0.6506 | 0.18 | 0.22 | 0.6689 | 0.22 |
| Length_NREM | Age on SR | -0.60 | 10.88 | -0.16 | 0.8752 | 0.06 | 0.03 | 0.8756 | 0.08 |
| Length_REM | Sleep on Young | 1.76 | 11.99 | 0.78 | 0.4479 | 0.24 | 0.62 | 0.4544 | 0.24 |
| Porc_Wake | Sleep on Old | 0.87 | 9.56 | 0.43 | 0.6746 | 0.11 | 0.19 | 0.6811 | 0.10 |
| Porc_NREM | Age on Control | 1.82 | 10.91 | 0.82 | 0.4277 | 0.30 | 0.68 | 0.4109 | 0.31 |
| Porc_REM | Age on SR | 0.94 | 10.77 | 0.46 | 0.6548 | 0.13 | 0.21 | 0.6085 | 0.13 |
| NmsSel | Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|---|
| N_Wake | Sleep on Young | 19.57 | 9.92 | 1.20 | 0.2581 | 0.32 | 1.44 | 0.2411 | 0.32 |
| N_NREM | Sleep on Old | 20.00 | 9.80 | 0.88 | 0.4019 | 0.22 | 0.77 | 0.3915 | 0.17 |
| N_REM | Age on Control | -15.74 | 10.07 | -0.71 | 0.4940 | 0.19 | 0.50 | 0.4978 | 0.21 |
| Length_Wake | Age on SR | -15.31 | 8.05 | -0.89 | 0.3989 | 0.25 | 0.79 | 0.4022 | 0.25 |
| Length_NREM | YSR vs OC | -35.31 | 7.36 | -1.84 | 0.1070 | 0.41 | 3.37 | 0.1123 | 0.42 |
| Length_REM | Sleep on Young | 23.71 | 8.88 | 1.03 | 0.3281 | 0.30 | 1.07 | 0.3311 | 0.30 |
| Porc_Wake | Sleep on Old | 38.33 | 5.66 | 2.73 | 0.0361 | 0.79 | 7.48 | 0.0523 | 0.81 |
| Porc_NREM | Age on Control | 6.50 | 10.10 | 0.26 | 0.7965 | 0.18 | 0.07 | 0.7689 | 0.18 |
| Porc_REM | Age on SR | 21.12 | 7.33 | 1.94 | 0.0923 | 0.59 | 3.75 | 0.1100 | 0.59 |
| N_Wake | YSR vs OC | -17.21 | 9.75 | -1.01 | 0.3375 | 0.23 | 1.02 | 0.3593 | 0.22 |
| N_NREM | Sleep on Young | 16.86 | 9.56 | 1.41 | 0.1911 | 0.52 | 1.98 | 0.1956 | 0.52 |
| N_REM | Sleep on Old | -13.83 | 9.83 | -0.84 | 0.4221 | 0.38 | 0.70 | 0.4538 | 0.32 |
| Length_Wake | Age on Control | 8.93 | 10.79 | 0.59 | 0.5653 | 0.22 | 0.35 | 0.5678 | 0.24 |
| Length_NREM | Age on SR | -21.76 | 7.25 | -1.58 | 0.1566 | 0.58 | 2.50 | 0.1682 | 0.58 |
| Length_REM | YSR vs OC | -7.93 | 7.86 | -0.64 | 0.5412 | 0.23 | 0.41 | 0.5484 | 0.20 |
| Porc_Wake | Sleep on Young | -4.32 | 10.03 | -0.18 | 0.8586 | 0.07 | 0.03 | 0.8478 | 0.07 |
| Porc_NREM | Sleep on Old | 7.88 | 9.97 | 0.57 | 0.5832 | 0.10 | 0.32 | 0.5522 | 0.13 |
| Porc_REM | Age on Control | 2.59 | 10.84 | 0.16 | 0.8747 | 0.12 | 0.03 | 0.8789 | 0.11 |
| N_Wake | Age on SR | 14.79 | 8.50 | 0.66 | 0.5239 | 0.27 | 0.44 | 0.5706 | 0.26 |
| N_NREM | YSR vs OC | 6.91 | 8.74 | 0.31 | 0.7657 | 0.22 | 0.09 | 0.7887 | 0.30 |
| N_REM | Sleep on Young | -45.20 | 11.98 | -1.86 | 0.0873 | 0.53 | 3.47 | 0.0878 | 0.53 |
| Length_Wake | Sleep on Old | -45.92 | 7.26 | -2.03 | 0.0809 | 0.91 | 4.10 | 0.1078 | 0.91 |
| Length_NREM | Age on Control | -6.38 | 10.21 | -0.24 | 0.8142 | 0.09 | 0.06 | 0.8011 | 0.10 |
| Length_REM | Age on SR | -7.10 | 9.35 | -0.35 | 0.7320 | 0.11 | 0.12 | 0.7056 | 0.09 |
| Porc_Wake | YSR vs OC | 38.83 | 10.38 | 1.45 | 0.1774 | 0.52 | 2.09 | 0.1947 | 0.52 |
| Porc_NREM | Sleep on Young | -12.54 | 10.25 | -2.67 | 0.0232 | 0.67 | 7.11 | 0.0267 | 0.67 |
| Porc_REM | Sleep on Old | -0.84 | 8.71 | -0.19 | 0.8572 | 0.09 | 0.03 | 0.8600 | 0.08 |
| N_Wake | Age on Control | -2.04 | 9.03 | -0.45 | 0.6653 | 0.14 | 0.20 | 0.6767 | 0.11 |
| N_NREM | Age on SR | 9.66 | 9.89 | 2.06 | 0.0665 | 0.60 | 4.25 | 0.0778 | 0.65 |
| N_REM | YSR vs OC | 10.50 | 10.98 | 1.92 | 0.0810 | 0.56 | 3.69 | 0.0723 | 0.58 |
| Length_Wake | Sleep on Young | 3.91 | 10.73 | 1.14 | 0.2788 | 0.32 | 1.30 | 0.2656 | 0.32 |
| Length_NREM | Sleep on Old | 5.46 | 8.20 | 1.31 | 0.2247 | 0.59 | 1.72 | 0.2383 | 0.61 |
| Length_REM | Age on Control | -2.32 | 9.95 | -0.51 | 0.6198 | 0.13 | 0.26 | 0.6333 | 0.17 |
| Porc_Wake | Age on SR | -0.77 | 10.66 | -0.27 | 0.7957 | 0.09 | 0.07 | 0.8020 | 0.09 |
| Porc_NREM | YSR vs OC | -6.23 | 7.89 | -1.53 | 0.1646 | 0.62 | 2.35 | 0.1735 | 0.64 |
| Porc_REM | Sleep on Young | -5.73 | 12.00 | -1.54 | 0.1490 | 0.42 | 2.38 | 0.1533 | 0.42 |
| N_Wake | Sleep on Old | -9.04 | 7.57 | -1.57 | 0.1568 | 0.38 | 2.47 | 0.1609 | 0.37 |
| N_NREM | Age on Control | 2.70 | 7.55 | 0.47 | 0.6506 | 0.18 | 0.22 | 0.6589 | 0.16 |
| N_REM | Age on SR | -0.60 | 10.88 | -0.16 | 0.8752 | 0.04 | 0.03 | 0.8808 | 0.08 |
| Length_Wake | YSR vs OC | 8.43 | 7.60 | 1.47 | 0.1816 | 0.39 | 2.16 | 0.1846 | 0.39 |
| Length_NREM | Sleep on Young | 1.76 | 11.99 | 0.78 | 0.4479 | 0.24 | 0.62 | 0.4578 | 0.24 |
| Length_REM | Sleep on Old | 0.87 | 9.56 | 0.43 | 0.6746 | 0.09 | 0.19 | 0.6719 | 0.12 |
| Porc_Wake | Age on Control | 1.82 | 10.91 | 0.82 | 0.4277 | 0.29 | 0.68 | 0.3904 | 0.29 |
| Porc_NREM | Age on SR | 0.94 | 10.77 | 0.46 | 0.6548 | 0.13 | 0.21 | 0.6211 | 0.13 |
| Porc_REM | YSR vs OC | 0.07 | 10.95 | 0.03 | 0.9768 | 0.09 | 0.00 | 0.9744 | 0.11 |
Figure 6. AAverage power spectra and relative delta (RDP) and theta (RTP) power during postlearning and recovery. A-D) Average NREM (A) and REM (B) power spectra and RDP in NREM (C) and RTP in REM during post-learning. E-H) Average NREM (E) and REM (F) power spectra and RDP in NREM (G) and RTP in REM (H) during recovery. RDP: 0.25-4 Hz, RTP: 4-10 Hz,. Young control (n=11), young SD (n=11), old control (n=8), old SD (n=10). Asterisks (*) represent significance using alpha=0.05. Statistical details in Supplemental Statistical Table corresponding to Figure 6.
NmBas="Fig6 C_D Band Power PostL"
NmFich<-paste0(PathDesign,"BandPowerPostL.csv");
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
DatDTFull <- data.table(read.table(NmFich, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
DatDT<-DatDTFull
DatDT$Group<-factor(DatDT$Group);DatDT$Group<-relevel(DatDT$Group,"Young_C")
ResFn<-ResAOV1<-list()
for (i in 1:5) {
DepVar<-names(DatDTFull)[8+i]
YuenRes<-WRS2::yuen(get(DepVar)~Group,DatDT)
ResFnPrv<-data.table(with(YuenRes,
cbind(DepV=DepVar,diff=round(diff,2),df=round(df,2),test=round(test,2),
EffSize=round(effsize,2),p=round(p.value,4))))
ResFn<-rbind(ResFn,ResFnPrv)
lvs<-c(4,7,8+i)
DatDTG<-DatDTFull[,..lvs];
DatDTG$Age<-factor(DatDTG$Age)
DatDTG$Age<-relevel(DatDTG$Age,"Young")
setkey(DatDTG,Age)
ArPGlobal<-c(lapply(1:2, function (x) DatDTG[.(levels(DatDTG$Age)[x]),3,with=F][[1]]),recursive = F)
ResAOV1[[i]]<-AOVSingle(ArPGlobal,2)
}
rbResRb22<-data.table(Vars=names(DatDTFull)[9:13],do.call(rbind, lapply(ResAOV1, as.data.table)))
GrpF<-list()
DepVar1<-names(DatDTFull)[8+1]
GrpF$A<- Grph.1(DatDT,DepVar1,LblsP =c("Preference for Displaced Object", "","Relative Delta Power"),c(0,50),F,GrpSel=c(1,3))
DepVar2<-names(DatDTFull)[8+2]
GrpF$B<- Grph.1(DatDT,DepVar2,LblsP =c("Preference for Displaced Object", "","Relative Sigma Power"),c(0,50),F,GrpSel=c(1,3))
DepVar3<-names(DatDTFull)[8+3]
GrpF$C<- Grph.1(DatDT,DepVar3,LblsP =c("Preference for Displaced Object", "","Relative Theta Power"),c(0,100),F,GrpSel=c(1,3))
DepVar4<-names(DatDTFull)[8+4]
GrpF$D<- Grph.1(DatDT,DepVar4,LblsP =c("Preference for Displaced Object", "","Relative Beta Power"),c(0,50),F,GrpSel=c(1,3))
DepVar5<-names(DatDTFull)[8+5]
GrpF$E<- Grph.1(DatDT,DepVar5,LblsP =c("Preference for Displaced Object", "",DepVar5),c(300,320),F,GrpSel=c(1,3))
ResRes<-list()
#ResRes[[1]]<-ResFn
ResRes[[1]]<-rbResRb22
AlmacenGen3(GrpP = GrpF,DataPas = ResRes,PathDesignP = PathDesign,NmBasP = NmBas, Typ=1)
NmBas2="Fig6C RelDeltaPower PostL"
pdf(paste0(NmFAlL,NmBas2,".pdf"))
GrpF$A
dev.off()
NmBas3="Fig6D RelTethaPower PostL"
pdf(paste0(NmFAlL,NmBas3,".pdf"))
GrpF$C
dev.off()
pdf(paste0(NmFAlL,NmBas,"TodosGraphs.pdf"))
GrpF
dev.off()
# All
rrt<-ExDataIS.3c(nmF = paste0(PathDesign,"BandPowerPostL.csv"),Vars = c(4,5,7,9:12),vIntP =c(4:7),lvlCh = list("Delta"="delta_NREM", "Sigma"="sigma_NREM","Theta"="theta_REM","Beta"="beta_REM"))
GrpF2<-list()
GrpF2<-Grph.3b(rrt$ExtendDT,"Moment",LblsP =c("Preference for Unmoved Objects", "","Relative Power"),c(0,100),GrpSel = c(1,3),F)
pdf(paste0(NmFAlL,NmBas,"TodosGraphs.pdf"))
GrpF2
dev.off()
#Results
print("Fig6C RelDeltaPower PostL")
plot(GrpF$A)
print("Fig6D RelTethaPower PostL")
plot(GrpF$C)
ResRes
Kbl3(ResRes, "Omnibus AOV. Design 2")quartz_off_screen
2
quartz_off_screen
2
$A
$B
$C
$D
$E
quartz_off_screen
2
quartz_off_screen
2
[1] "Fig6C RelDeltaPower PostL"
[1] "Fig6D RelTethaPower PostL"
[[1]]
Vars t
1: delta_NREM Diff = -4.17, V(9.63) = 0.87, Eff.Size = 0.26, p = 0.4057
2: sigma_NREM Diff = 2.77, V(8.18) = 1.77, Eff.Size = 0.64, p = 0.1147
3: theta_REM Diff = 7.97, V(5.59) = 1.02, Eff.Size = 0.49, p = 0.3495
4: beta_REM Diff = 1.27, V(8.71) = 0.9, Eff.Size = 0.27, p = 0.3939
5: totalPercent Diff = 1.24, V(10.98) = 1.89, Eff.Size = 0.54, p = 0.0852
tRk1 t.2.Diff
1: Diff = -4.17, Fw(1,13.46) = 0.56, Eff.Size = 0.26, p = 0.4665 -4.17
2: Diff = 2.77, Fw(1,14.49) = 1.35, Eff.Size = 0.64, p = 0.2635 2.77
3: Diff = 7.97, Fw(1,12.89) = 0.56, Eff.Size = 0.49, p = 0.469 7.97
4: Diff = 1.27, Fw(1,11.05) = 1.06, Eff.Size = 0.27, p = 0.3247 1.27
5: Diff = 1.24, Fw(1,14.3) = 2.34, Eff.Size = 0.54, p = 0.1476 1.24
t.2.DF t.2.FW t.2.Ef.Size t.2.p tRk2.Diff tRk2.DF1 tRk2.DF2 tRk2.Fw
1: 9.63 0.87 0.26 0.4057 -4.17 1 13.46 0.56
2: 8.18 1.77 0.64 0.1147 2.77 1 14.49 1.35
3: 5.59 1.02 0.49 0.3495 7.97 1 12.89 0.56
4: 8.71 0.90 0.27 0.3939 1.27 1 11.05 1.06
5: 10.98 1.89 0.54 0.0852 1.24 1 14.30 2.34
tRk2.Ef.Size tRk2.p
1: 0.26 0.4665
2: 0.64 0.2635
3: 0.49 0.4690
4: 0.27 0.3247
5: 0.54 0.1476
|
NmBas="Fig6G RelDeltaPowerNREM Recover"
rrt<-ExData.2(nmF = paste0(PathDesign,"BandPowerRecover.csv"),Vars = c(4:5,9))
DatDT<-rrt$DT
ArP<-rrt$Arp
#Graphs
Grp<- Grph.2(DatDT,"delta_NREM",LblsP =c("Preference for Unmoved Objects", "","Relative Delta Power"),c(0,50),F)
Grp2<- Grp + geom_signif(annotation="*",
y_position=40, xmin=1 , xmax=2,
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10) +
geom_signif(annotation="*",
y_position=40, xmin=3 , xmax=4,
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10)
# AOV & Simple Effects
names(rrt$DT)[3]<-"DepV"
ResGen<-AOVBwF(2,2,DatPas = rrt,nBMM = 10000)
AlmacenGen(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign,NmBasP = NmBas,Typ=1)
#Results Fig6G RelDeltaPowerNREM Recover
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResGen[[1]], "Omnibus AOV. Design 2x2");cat("\n")
Kbl3(ResGen[[2]], "Simple Effects Age-Sleep. Design 2x2")
Kbl3(ResGen[[3]], "Extense Simple Effects Age-Sleep. Design 2x2")
NmBas="Fig6H RelThetaPowerREM Recover"
rrt<-ExData.2(nmF = paste0(PathDesign,"BandPowerRecover.csv"),Vars = c(4:5,11))
DatDT<-rrt$DT
ArP<-rrt$Arp
#Graphs
Grp<- Grph.2(DatDT,"theta_REM",LblsP =c("Preference for Unmoved Objects", "","Relative Theta Power"),c(0,100),F)
Grp2=Grp
# AOV & Simple Effects
names(rrt$DT)[3]<-"DepV"
ResGen<-AOVBwF(2,2,DatPas = rrt,nBMM = 10000)
AlmacenGen(Grp,Grp2,ResGen,PathDesign,NmBas,Typ=1)
#Results Fig6H RelThetaPowerREM Recover
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResGen[[1]], "Omnibus AOV. Design 2x2");cat("\n")
Kbl3(ResGen[[2]], "Simple Effects Age-Sleep. Design 2x2")
Kbl3(ResGen[[3]], "Extense Simple Effects Age-Sleep. Design 2x2")
# All
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"BandPowerRecover.csv"),Vars = c(4,5,7,9:12),vIntP =c(4:7),
lvlCh = list("Delta"="delta_NREM", "Sigma"="sigma_NREM","Theta"="theta_REM","Beta"="beta_REM"))
GrpF<-Grph.3(rrt$ExtendDT,"Moment",LblsP =c("Preference for Unmoved Objects", "","Relative Power"),c(0,100),F)
NmBas="FigBP_Band Power Recover All Bands"
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
pdf(paste0(NmFAlL,NmBas,"TodosGraphs.pdf"))
GrpF
dev.off()[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.5659
2: B.p.value 0.0067 *
3: AB.p.value 0.0868
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.5717
2: B.p.value 0.0069 *
3: AB.p.value 0.8927
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.33 0.574 0.33 0.574 0.38 0.5434 0.5659 0.5717
2: Sleep 9.40 0.007 9.40 0.007 9.23 0.0052 0.0067 * 0.0069 *
3: Age*Sleep 0.02 0.895 0.04 0.840 0.01 0.9393 0.0868 0.8927
EffSize
1: 0.16
2: 0.64
3: 0.05
$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -7.21 11.12 -2.19 0.0507 0.67 4.80 0.0422
2: Sleep on Old -6.60 6.33 -2.15 0.0731 0.64 4.61 0.0833
3: Age on Control -1.60 9.10 -0.46 0.6586 0.13 0.21 0.6578
4: Age on SR -0.99 7.87 -0.35 0.7365 0.13 0.12 0.7289
EffSize.Boot
1: 0.67
2: 0.64
3: 0.13
4: 0.17
$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -7.21 11.12 -2.19 0.0507 0.67 4.80 0.0400
2: Sleep on Old -6.60 6.33 -2.15 0.0731 0.64 4.61 0.0611
3: Age on Control -1.60 9.10 -0.46 0.6586 0.12 0.21 0.6541
4: Age on SR -0.99 7.87 -0.35 0.7365 0.15 0.12 0.7156
5: YSR vs OC 5.61 10.64 1.44 0.1799 0.51 2.06 0.1791
EffSize.Boot
1: 0.67
2: 0.64
3: 0.13
4: 0.10
5: 0.52
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.33 | 0.574 | 0.33 | 0.574 | 0.38 | 0.5434 | 0.5659 | 0.5717 | 0.16 | ||
| Sleep | 9.40 | 0.007 | 9.40 | 0.007 | 9.23 | 0.0052 | 0.0067 |
|
0.0069 |
|
0.64 |
| Age*Sleep | 0.02 | 0.895 | 0.04 | 0.840 | 0.01 | 0.9393 | 0.0868 | 0.8927 | 0.05 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -7.21 | 11.12 | -2.19 | 0.0507 | 0.67 | 4.80 | 0.0422 | 0.67 |
| Sleep on Old | -6.60 | 6.33 | -2.15 | 0.0731 | 0.64 | 4.61 | 0.0833 | 0.64 |
| Age on Control | -1.60 | 9.10 | -0.46 | 0.6586 | 0.13 | 0.21 | 0.6578 | 0.13 |
| Age on SR | -0.99 | 7.87 | -0.35 | 0.7365 | 0.13 | 0.12 | 0.7289 | 0.17 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -7.21 | 11.12 | -2.19 | 0.0507 | 0.67 | 4.80 | 0.0400 | 0.67 |
| Sleep on Old | -6.60 | 6.33 | -2.15 | 0.0731 | 0.64 | 4.61 | 0.0611 | 0.64 |
| Age on Control | -1.60 | 9.10 | -0.46 | 0.6586 | 0.12 | 0.21 | 0.6541 | 0.13 |
| Age on SR | -0.99 | 7.87 | -0.35 | 0.7365 | 0.15 | 0.12 | 0.7156 | 0.10 |
| YSR vs OC | 5.61 | 10.64 | 1.44 | 0.1799 | 0.51 | 2.06 | 0.1791 | 0.52 |
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.6561
2: B.p.value 0.5977
3: AB.p.value 0.3105
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.6279
2: B.p.value 0.6018
3: AB.p.value 0.1639
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.26 0.620 0.26 0.620 0.35 0.5611 0.6561 0.6279
2: Sleep 0.30 0.594 0.30 0.594 0.49 0.4921 0.5977 0.6018
3: Age*Sleep 2.25 0.158 -0.33 0.100 2.37 0.1355 0.3105 0.1639
EffSize
1: 0.18
2: 0.20
3: 0.60
$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 10.15 7.24 1.73 0.1256 0.66 3.00 0.1389
2: Sleep on Old -4.71 6.45 -0.59 0.5757 0.31 0.35 0.6018
3: Age on Control 4.91 5.59 0.64 0.5483 0.32 0.41 0.5595
4: Age on SR -9.96 8.94 -1.59 0.1469 0.57 2.52 0.1578
EffSize.Boot
1: 0.66
2: 0.32
3: 0.43
4: 0.55
$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 10.15 7.24 1.73 0.1256 0.66 3.00 0.1222
2: Sleep on Old -4.71 6.45 -0.59 0.5757 0.33 0.35 0.6156
3: Age on Control 4.91 5.59 0.64 0.5483 0.33 0.41 0.5567
4: Age on SR -9.96 8.94 -1.59 0.1469 0.55 2.52 0.1478
5: YSR vs OC -5.24 9.64 -0.56 0.5868 0.18 0.32 0.6022
EffSize.Boot
1: 0.66
2: 0.31
3: 0.43
4: 0.57
5: 0.21
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.26 | 0.620 | 0.26 | 0.620 | 0.35 | 0.5611 | 0.6561 | 0.6279 | 0.18 | ||
| Sleep | 0.30 | 0.594 | 0.30 | 0.594 | 0.49 | 0.4921 | 0.5977 | 0.6018 | 0.20 | ||
| Age*Sleep | 2.25 | 0.158 | -0.33 | 0.100 | 2.37 | 0.1355 | 0.3105 | 0.1639 | 0.60 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 10.15 | 7.24 | 1.73 | 0.1256 | 0.66 | 3.00 | 0.1389 | 0.66 |
| Sleep on Old | -4.71 | 6.45 | -0.59 | 0.5757 | 0.31 | 0.35 | 0.6018 | 0.32 |
| Age on Control | 4.91 | 5.59 | 0.64 | 0.5483 | 0.32 | 0.41 | 0.5595 | 0.43 |
| Age on SR | -9.96 | 8.94 | -1.59 | 0.1469 | 0.57 | 2.52 | 0.1578 | 0.55 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 10.15 | 7.24 | 1.73 | 0.1256 | 0.66 | 3.00 | 0.1222 | 0.66 |
| Sleep on Old | -4.71 | 6.45 | -0.59 | 0.5757 | 0.33 | 0.35 | 0.6156 | 0.31 |
| Age on Control | 4.91 | 5.59 | 0.64 | 0.5483 | 0.33 | 0.41 | 0.5567 | 0.43 |
| Age on SR | -9.96 | 8.94 | -1.59 | 0.1469 | 0.55 | 2.52 | 0.1478 | 0.57 |
| YSR vs OC | -5.24 | 9.64 | -0.56 | 0.5868 | 0.18 | 0.32 | 0.6022 | 0.21 |
quartz_off_screen
2
Figure 7. Spindle characteristics. A) Representation of the automated spindle detection method. Top panel shows the cubed root-mean squared (RMS) of the filtered EEG computed over 750 ms windows. The spindle detection method used a two-threshold approach. These values are derived from the mean cubed RMS transform value of all the NREM traces and included both a lower threshold and upper threshold. The second panel shows the band-pass filtered EEG, followed by the unfiltered EEG signal, and the results of the spindle detection. The bottom panel shows the corresponding EMG signal. Red marks the regions of the signal where spindles are detected, 1 indicates the presence and 0 the absence of spindles, respectively. B-D) Spindle counts (B), duration (C), and frequency (D) during the post-learning sleep period. B) There were no differences between the groups in total average number of spindles, but segment analysis revealed that old control animals displayed fewer spindles than young control animals during the first hour post-learning. C-D) There were no differences in spindles duration (D) or frequency (D) during post-learning. E-G) Spindle numbers (E), duration (F), and frequency (G) during recovery. G) Old SD animals displayed more average total number of spindles than old controls during the 5 hr recovery sleep period. The 1 hr segment analysis indicated that the groups displayed more spindles during the last segment than the preceding one. F) There were no differences in spindle duration. G) Young SD mice displayed higher spindle frequency than old SD animals. Young control (n=11), young SD (n=11), old control (n=8), old SD (n=10). Asterisks (*) represent significance using alpha=0.05. Statistical details in Supplemental Statistical Table corresponding to Figure 7.
NmBas="Fig7B SpindCount PosL"
NmFich<-paste0(PathDesign,"DeltaTetaSpindlePostL.csv");
DatDTFull <- data.table(read.table(NmFich, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
ResGen<-NA;rbResRbGl<-list()
# Graphs Previously
rrt<-ExDataIS.3c(nmF = NmFich,Vars = ,c(4,5,7,17:22),vIntP =c(4:9),lvlCh = list("Hr 1"="NREM_Spindle_1", "Hr 2"="NREM_Spindle_2","Hr 3"="NREM_Spindle_3","Hr 4"="NREM_Spindle_4","Hr 5"="NREM_Spindle_5","Total"="NREM_Spindle_TT"))
DatDT<-rrt$DT
ArP<-rrt$Arp
ExtendDT<-rrt$ExtendDT
Grp<- Grph.3b(DatP = ExtendDT,"OPR",LblsP =c("Spindle Characteristics", "","Spindle Count"),ylmP =c(0,500),hLin = F,lvIp = 6,GrpSel = c(1,3))
levBp<-seq(0.8, 6, by=0.4)
Grp2<- Grp + geom_signif(annotation="*",
y_position=350, xmin=levBp[1] , xmax=levBp[2],
tip_length = c(0.20, 0.35),vjust = 0.5, textsize=10)
#AOV 1 Global
DatDTG<-DatDTFull[,c(4,7,22)];
DatDTG$Age<-factor(DatDTG$Age)
DatDTG$Age<-relevel(DatDTG$Age,"Young")
setkey(DatDTG,Age)
ArPGlobal<-c(lapply(1:2, function (x) DatDTG[.(levels(DatDTG$Age)[x]),3,with=F][[1]]),recursive = F)
ResAOV1<-AOVSingle(ArPGlobal,2)
rbResRbGl$AOV<-do.call(cbind, lapply(ResAOV1, as.data.table))
write.csv2(rbResRbGl$AOV,paste0(NmFAlL, NmBas,"GlobalOmnContr.csv"))
#AOV 2 For Time Details
rrt2<-ExDataIS.3c(nmF = NmFich,Vars = ,c(4,5,7,17:21),vIntP =c(4:8),lvlCh = list("Hr 1"="NREM_Spindle_1", "Hr 2"="NREM_Spindle_2","Hr 3"="NREM_Spindle_3","Hr 4"="NREM_Spindle_4","Hr 5"="NREM_Spindle_5"))
names(rrt2$DT)[3:7]<-c("T1","T2","T3","T4","T5")
ResGen<-AOVMx2b(A=2,C=5,DatPas = rrt2,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
AlmacenGen(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign,NmBasP = NmBas,Typ=1)
# Other Graphs for Time details
ExtendDT2<-rrt2$ExtendDT
ExtendDTCol<-copy(ExtendDT2)
ExtendDTCol$Moment<-"All"
ExtendDTCol<-data.table(rbind(ExtendDT2,ExtendDTCol))
Grp3<- Grph.3b(DatP = ExtendDTCol,"OPR",LblsP =c("Spindle Characteristics", "","Spindle Count"),ylmP =c(0,500),hLin = F,lvIp = 6,GrpSel = c(1,3),wMain = T)
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
dev.off()
#Results
plot(Grp)
plot(Grp2)
plot(Grp3)
#AOV 1 Global
rbResRbGl
Kbl3(rbResRbGl, "Global Omnibus AOV. Design 2")
#AOV 2 For Time Details
ResGen
Kbl3(ResGen[[1]], "Omnibus AOV. Design 2x(5xS)")
Kbl3(ResGen[[2]], "Simple Effects Age-Time. Design 2x(5xS)")
Kbl3(ResGen[[3]], "Main Effects Time. Design 2x(5xS)")[1] "Taking bootstrap samples. Please wait."
[1] "Taking bootstrap samples. Please wait."
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
quartz_off_screen
2
$AOV
t.V1
1: Diff = 4.33, V(10.99) = 0.52, Eff.Size = 0.17, p = 0.6148
tRk1.V1 t.2.Diff t.2.DF
1: Diff = 4.33, Fw(1,14.93) = 0.22, Eff.Size = 0.17, p = 0.6445 4.33 10.99
t.2.FW t.2.Ef.Size t.2.p tRk2.Diff tRk2.DF1 tRk2.DF2 tRk2.Fw tRk2.Ef.Size
1: 0.52 0.17 0.6148 4.33 1 14.93 0.22 0.17
tRk2.p
1: 0.6445
|
$AOV
Names Q p pBoot Sig pBootMas Sig2 EffSize
1: Age 0.86 0.3767 0.4073 0.3741 0.02
2: Trial 9.07 0.0043 0.0417 * 0.0401 * 0.41
3: Age*Trial 4.52 0.0324 0.1018 0.1135 0.43
$InterAC
Contr psihat df test p.value EfSize.V1
1: Age on M1 128.83 10.06 4.18 0.0019 0.83
2: Age on M2 15.45 8.23 0.34 0.7408 0.13
3: Age on M3 -35.71 6.96 -1.01 0.3446 0.37
4: Age on M4 -40.43 10.24 -1.29 0.2248 0.38
5: Age on M5 -14.36 7.36 -0.36 0.7278 0.11
6: M1-M2 on Young -60.00 NA -1.32 0.2454 0.55
7: M1-M2 on Old -159.50 NA -4.92 0.0044 0.83
8: M2-M3 on Young 12.50 NA 0.23 0.8289 0.21
9: M2-M3 on Old -19.00 NA -0.28 0.7939 0.21
10: M3-M4 on Young 58.67 NA 1.65 0.1601 0.32
11: M3-M4 on Old 14.00 NA 0.24 0.8199 0.19
12: M4-M5 on Young 0.83 NA 0.02 0.9842 0.20
13: M4-M5 on Old 31.67 NA 0.51 0.6330 0.32
$DetallMainC
Contr psihat test p.value Psihat2 p.value2 EfSize.V1
1: M1-M2 -207.83 -4.73 0.0052 -225.95 0.00 0.71
2: M2-M3 -19.33 -0.26 0.8086 -11.17 0.80 0.01
3: M3-M4 54.83 0.95 0.3849 48.71 0.32 0.25
4: M4-M5 62.83 1.26 0.2632 60.93 0.24 0.29
| Names | Q | p | pBoot | Sig | pBootMas | Sig2 | EffSize |
|---|---|---|---|---|---|---|---|
| Age | 0.86 | 0.3767 | 0.4073 | 0.3741 | 0.02 | ||
| Trial | 9.07 | 0.0043 | 0.0417 |
|
0.0401 |
|
0.41 |
| Age*Trial | 4.52 | 0.0324 | 0.1018 | 0.1135 | 0.43 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Age on M1 | 128.83 | 10.06 | 4.18 | 0.0019 | 0.83 |
| Age on M2 | 15.45 | 8.23 | 0.34 | 0.7408 | 0.13 |
| Age on M3 | -35.71 | 6.96 | -1.01 | 0.3446 | 0.37 |
| Age on M4 | -40.43 | 10.24 | -1.29 | 0.2248 | 0.38 |
| Age on M5 | -14.36 | 7.36 | -0.36 | 0.7278 | 0.11 |
| M1-M2 on Young | -60.00 | NA | -1.32 | 0.2454 | 0.55 |
| M1-M2 on Old | -159.50 | NA | -4.92 | 0.0044 | 0.83 |
| M2-M3 on Young | 12.50 | NA | 0.23 | 0.8289 | 0.21 |
| M2-M3 on Old | -19.00 | NA | -0.28 | 0.7939 | 0.21 |
| M3-M4 on Young | 58.67 | NA | 1.65 | 0.1601 | 0.32 |
| M3-M4 on Old | 14.00 | NA | 0.24 | 0.8199 | 0.19 |
| M4-M5 on Young | 0.83 | NA | 0.02 | 0.9842 | 0.20 |
| M4-M5 on Old | 31.67 | NA | 0.51 | 0.6330 | 0.32 |
| Contr | psihat | test | p.value | Psihat2 | p.value2 | EfSize.V1 |
|---|---|---|---|---|---|---|
| M1-M2 | -207.83 | -4.73 | 0.0052 | -225.95 | 0.00 | 0.71 |
| M2-M3 | -19.33 | -0.26 | 0.8086 | -11.17 | 0.80 | 0.01 |
| M3-M4 | 54.83 | 0.95 | 0.3849 | 48.71 | 0.32 | 0.25 |
| M4-M5 | 62.83 | 1.26 | 0.2632 | 60.93 | 0.24 | 0.29 |
# Command selection. Copy the rest of the lines of code from the chunk of the reference figure and in the same order.
# Fig 7C Duration during the post-learning sleep period {Design 2x((5+1)xS)
# As Fig.7B
rrt<-ExDataIS.3c(nmF = NmFich,Vars = ,c(4,5,7,23:28),vIntP =c(4:9),lvlCh = list("Hr 1"="Avg_SpindleDuration_NREM_1", "Hr 2"="Avg_SpindleDuration_NREM_2","Hr 3"="Avg_SpindleDuration_NREM_3","Hr 4"="Avg_SpindleDuration_NREM_4","Hr 5"="Avg_SpindleDuration_NREM_5","Total"="Avg_SpindleDuration_NREM_TT"))
Grp<- Grph.3b(DatP = ExtendDT,"OPR",LblsP =c("Spindle Characteristics", "","Spindle Duration (s)"),ylmP =c(0,3),hLin = F,lvIp = 6,GrpSel = c(1,3))
#AOV 1 Global
DatDTG<-DatDTFull[,c(4,7,28)];
#AOV 2 For Time Details
rrt2<-ExDataIS.3c(nmF = NmFich,Vars = ,c(4,5,7,23:27),vIntP =c(4:8),lvlCh = list("Hr 1"="Avg_SpindleDuration_NREM_1", "Hr 2"="Avg_SpindleDuration_NREM_2","Hr 3"="Avg_SpindleDuration_NREM_3","Hr 4"="Avg_SpindleDuration_NREM_4","Hr 5"="Avg_SpindleDuration_NREM_5"))
ResGen<-AOVMx2b(A=2,C=5,DatPas = rrt2,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
# Fig 7D Frequency during the post-learning sleep period {Design 2x((5+1)xS)
# As Fig.7B
rrt<-ExDataIS.3c(nmF = NmFich,Vars = ,c(4,5,7,29:34),vIntP =c(4:9),lvlCh = list("Hr 1"="Avg_SpindleHz_NREM_1", "Hr 2"="Avg_SpindleHz_NREM_2","Hr 3"="Avg_SpindleHz_NREM_3","Hr 4"="Avg_SpindleHz_NREM_4","Hr 5"="Avg_SpindleHz_NREM_5","Total"="Avg_SpindleHz_NREM_TT"))
Grp<- Grph.3b(DatP = ExtendDT,"OPR",LblsP =c("Spindle Characteristics", "","Spindle Frequency (Hz)"),ylmP =c(10,12),hLin = F,lvIp = 6,GrpSel = c(1,3))
#AOV 1 Global
DatDTG<-DatDTFull[,c(4,7,34)];
#AOV 2 For Time Details
rrt2<-ExDataIS.3c(nmF = NmFich,Vars = ,c(4,5,7,29:33),vIntP =c(4:8),lvlCh = list("Hr 1"="Avg_SpindleHz_NREM_1", "Hr 2"="Avg_SpindleHz_NREM_2","Hr 3"="Avg_SpindleHz_NREM_3","Hr 4"="Avg_SpindleHz_NREM_4","Hr 5"="Avg_SpindleHz_NREM_5"))
ResGen<-AOVMx2b(A=2,C=5,DatPas = rrt2,nBMM1 = 10000,nBMM2 = 1000,Prc = 2) NmBas="Fig7E SpindCount Recover"
NmFich<-paste0(PathDesign,"DeltaTetaSpindleRecover.csv");
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
ResGen<-NA;ResGen1<-NA;
# Graphs Previously
rrt<-ExDataIS.2(nmF = NmFich,Vars = ,c(4,5,7,9:14),vIntP =c(4:9),lvlCh = list("Hr 1"="NREM_Spindle_1", "Hr 2"="NREM_Spindle_2","Hr 3"="NREM_Spindle_3","Hr 4"="NREM_Spindle_4","Hr 5"="NREM_Spindle_5","Total"="NREM_Spindle_TT"))
DatDT<-rrt$DT
ArP<-rrt$Arp
ExtendDT<-rrt$ExtendDT
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Spindle Characteristics", "","Spindle Count"),ylmP =c(0,500),hLin = F,lvIp = 6)
levBp<-seq(0.7, 25, by=0.2)
Grp2<- Grp + geom_signif(annotation="*",
y_position=325, xmin=levBp[2+25] , xmax=levBp[4+25],
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10) +
geom_signif(annotation="*",
y_position=300, xmin=levBp[3+25] , xmax=levBp[4+25],
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10)+
geom_signif(annotation=c("","","*"),
y_position=c(300,320,330),
xmin=c(levBp[1+15],levBp[1+20], mean(levBp[c(1+15,4+15)])),
xmax=c(levBp[4+15],levBp[4+20], mean(levBp[c(1+20,4+20)])),
tip_length = c(c(0.02, 0.02),c(0.02, 0.02),c(.05, 0.02)),vjust=0.5,textsize=10)
#AOV 1 Global
rrt<-ExData.2(nmF = NmFich,Vars = c(4,5,14))
DatDT<-rrt$DT
ArP<-rrt$Arp
names(rrt$DT)[3]<-"DepV"
ResGen1<-AOVBwF(2,2,DatPas = rrt,nBMM = 10000)
AlmacenGen(Grp,Grp2,ResGen1,PathDesign,paste0(NmBas,"_Total"),Typ=1)
#AOV 2 For Time Details
rrt2<-ExDataIS.2(nmF = NmFich,Vars = c(4,5,7,9:13),vIntP =c(4:8),lvlCh = list("Hr 1"="NREM_Spindle_1", "Hr 2"="NREM_Spindle_2","Hr 3"="NREM_Spindle_3","Hr 4"="NREM_Spindle_4","Hr 5"="NREM_Spindle_5"))
DatDT<-rrt2$DT
ArP<-rrt2$Arp
ExtendDT<-rrt2$ExtendDT
# Simple Effects:
DatEfS<-list()
for(is in 1:5) {
DatEfS[[is]]<-ExData.2(nmF = NmFich,Vars = c(4:5,(8+is)))
names(DatEfS[[is]]$DT)[3]<-"DepV"
}
names(rrt2$DT)[4:8]<-c("T1","T2","T3","T4","T5")
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt2,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
AlmacenGen2(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign, NmBasP = paste0(NmBas,"_TimeDetail"),Typ=2)
# Other Graphs for Time details
ExtendDT2<-rrt2$ExtendDT
ExtendDTCol<-copy(ExtendDT2)
ExtendDTCol$Moment<-"All"
ExtendDTCol<-data.table(rbind(ExtendDT2,ExtendDTCol))
Grp3<- Grph.3(DatP = ExtendDTCol,"OPR",LblsP =c("Spindle Characteristics", "","Spindle Count"),ylmP =c(0,500),hLin = F,lvIp = 6,wMain = T)
GrpO<-Grph.3.Otros(ExtendDT,LblsP =c("Spindle Characteristics", "","Spindle Count"))
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
GrpO
dev.off()
#Results
#AOV 1 Global
ResGen1
Kbl3(ResGen1[[1]], "Omnibus AOV. Design 2x2")
Kbl3(ResGen1[[2]], "Simple Effects Age-Sleep. Design 2x2")
Kbl3(ResGen1[[3]], "Extense Simple Effects Age-Sleep. Design 2x2")
#AOV 2 For Time Details
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
GrpO
plot(Grp3)
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResPas = ResGen[[1]], lbl = "Omnibus AOV. Design 2x2x(5xS)");cat("\n")
Kbl3(ResGen[[2]], "Interaction Age-Sleep. Design 2x2x(5xS)")
Kbl3(ResGen[[3]], "Interaction Age-Time. Design 2x2x(5xS)")
Kbl3(ResGen[[4]], "Interaction Sleep-Time. Design 2x2x(5xS)")
Kbl3(ResGen[[5]], "Main Effect Time. Design 2x2x(5xS)")
Kbl3(ResGen[[6]], "Simple Effect Time each Age-Sleep condition. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[1]], "Simple Effect Age-Sleep on Time=1 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[2]], "Simple Effect Age-Sleep on Time=1 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[3]], "Simple Effect Age-Sleep on Time=1 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[1]], "Simple Effect Age-Sleep on Time=2 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[2]], "Simple Effect Age-Sleep on Time=2 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[3]], "Simple Effect Age-Sleep on Time=2 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[1]], "Simple Effect Age-Sleep on Time=3 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[2]], "Simple Effect Age-Sleep on Time=3 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[3]], "Simple Effect Age-Sleep on Time=3 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[1]], "Simple Effect Age-Sleep on Time=4 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[2]], "Simple Effect Age-Sleep on Time=4 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[3]], "Simple Effect Age-Sleep on Time=4 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[1]], "Simple Effect Age-Sleep on Time=5 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[2]], "Simple Effect Age-Sleep on Time=5 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[3]], "Simple Effect Age-Sleep on Time=5 Extense Simple Effects. Design 2x2x(5xS)")[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.0835
2: B.p.value 0.0818
3: AB.p.value NA
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.0644
2: B.p.value 0.0679
3: AB.p.value 0.0203 *
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
Eff p.V1 p.Sig
1: p.value.A 0.3055
2: p.value.B 0.4674
3: p.value.C 0.0083 *
4: p.value.AB 0.0851
5: p.value.AC 0.1836
6: p.value.BC 0.8414
7: p.value.ABC 0.6962
Eff p.V1 p.Sig
1: p.value.A 0.3096
2: p.value.B 0.4621
3: p.value.C 0.0003 *
4: p.value.AB 0.0000 *
5: p.value.AC 0.1091
6: p.value.BC 0.8325
7: p.value.ABC 0.6316
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
quartz_off_screen
2
$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 3.59 0.075 3.59 0.075 2.17 0.1502 0.0835 0.0644
2: Sleep 3.47 0.080 3.47 0.080 2.07 0.1598 0.0818 0.0679
3: Age*Sleep 6.50 0.020 -0.30 0.110 2.70 0.1101 NA 0.0203 *
EffSize
1: 0.33
2: 0.27
3: 0.61
$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 4.53 7.80 0.46 0.6557 0.14 0.21 0.6496
2: Sleep on Old -29.10 8.85 -3.29 0.0096 0.60 10.81 0.0078
3: Age on Control 4.31 10.83 0.37 0.7188 0.13 0.14 0.7086
4: Age on SR -29.32 9.37 -4.77 0.0009 0.73 22.75 0.0022
EffSize.Boot
1: 0.14
2: 0.58
3: 0.14
4: 0.75
$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 4.53 7.80 0.46 0.6557 0.14 0.21 0.6522
2: Sleep on Old -29.10 8.85 -3.29 0.0096 0.57 10.81 0.0033
3: Age on Control 4.31 10.83 0.37 0.7188 0.11 0.14 0.7289
4: Age on SR -29.32 9.37 -4.77 0.0009 0.76 22.75 0.0011
5: YSR vs OC -0.22 7.33 -0.03 0.9792 0.11 0.00 0.9822
EffSize.Boot
1: 0.14
2: 0.57
3: 0.12
4: 0.75
5: 0.09
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 3.59 | 0.075 | 3.59 | 0.075 | 2.17 | 0.1502 | 0.0835 | 0.0644 | 0.33 | ||
| Sleep | 3.47 | 0.080 | 3.47 | 0.080 | 2.07 | 0.1598 | 0.0818 | 0.0679 | 0.27 | ||
| Age*Sleep | 6.50 | 0.020 | -0.30 | 0.110 | 2.70 | 0.1101 | NA | 0.0203 |
|
0.61 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 4.53 | 7.80 | 0.46 | 0.6557 | 0.14 | 0.21 | 0.6496 | 0.14 |
| Sleep on Old | -29.10 | 8.85 | -3.29 | 0.0096 | 0.60 | 10.81 | 0.0078 | 0.58 |
| Age on Control | 4.31 | 10.83 | 0.37 | 0.7188 | 0.13 | 0.14 | 0.7086 | 0.14 |
| Age on SR | -29.32 | 9.37 | -4.77 | 0.0009 | 0.73 | 22.75 | 0.0022 | 0.75 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 4.53 | 7.80 | 0.46 | 0.6557 | 0.14 | 0.21 | 0.6522 | 0.14 |
| Sleep on Old | -29.10 | 8.85 | -3.29 | 0.0096 | 0.57 | 10.81 | 0.0033 | 0.57 |
| Age on Control | 4.31 | 10.83 | 0.37 | 0.7188 | 0.11 | 0.14 | 0.7289 | 0.12 |
| Age on SR | -29.32 | 9.37 | -4.77 | 0.0009 | 0.76 | 22.75 | 0.0011 | 0.75 |
| YSR vs OC | -0.22 | 7.33 | -0.03 | 0.9792 | 0.11 | 0.00 | 0.9822 | 0.09 |
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
$AOV
Names Q p pBoot Sig pBootMas Sig2
1: Age 1.06 0.3042 0.3055 0.3096
2: Sleep 0.55 0.4567 0.4674 0.4621
3: Time 0.90 0.4654 0.0083 * 0.0003 *
4: Age*Sleep 3.04 0.0814 0.0851 0.0000 *
5: Age*Time 0.23 0.9237 0.1836 0.1091
6: Sleep*Time 0.04 0.9973 0.8414 0.8325
7: Age*Sleep*Time 0.07 0.9917 0.6962 0.6316
$InterAB
Contr psihat df test p.value EfSize.V1
1: Sleep on Young 33.24 37.64 0.43 0.6683 0.14
2: Sleep on Old -127.50 30.19 -1.39 0.1752 0.58
3: Age on Control 20.31 34.13 0.21 0.8314 0.14
4: Age on SR -140.43 31.17 -1.91 0.0651 0.75
$InterAC
Contr psihat df test p.value EfSize.V1
1: Age on M1 -40.45 20.96 -0.95 0.3523 0.24
2: Age on M2 -86.95 14.56 -1.56 0.1407 0.32
3: Age on M3 16.98 11.05 0.30 0.7675 0.08
4: Age on M4 79.88 8.23 1.56 0.1552 0.40
5: Age on M5 -89.57 18.17 -1.47 0.1575 0.39
6: M1-M2 on Young 86.50 NA 1.29 0.2546 0.23
7: M1-M2 on Old 69.33 NA 0.95 0.3837 0.11
8: M2-M3 on Young 18.00 NA 0.21 0.8418 0.23
9: M2-M3 on Old 112.50 NA 1.17 0.2961 0.45
10: M3-M4 on Young 55.17 NA 0.74 0.4903 0.19
11: M3-M4 on Old 66.00 NA 0.74 0.4899 0.45
12: M4-M5 on Young 19.50 NA 0.52 0.6278 0.18
13: M4-M5 on Old -130.17 NA -1.99 0.1026 0.51
$InterBC
Contr psihat df test p.value EfSize.V1
1: Sleep on M1 -15.88 20.96 -0.37 0.7125 0.04
2: Sleep on M2 -38.81 14.56 -0.70 0.4978 0.16
3: Sleep on M3 -85.60 11.05 -1.53 0.1546 0.34
4: Sleep on M4 24.79 8.23 0.49 0.6400 0.16
5: Sleep on M5 21.24 18.17 0.35 0.7307 0.16
6: M1-M2 on Young 104.83 NA 1.24 0.2687 0.29
7: M1-M2 on Old 86.50 NA 0.94 0.3909 0.12
8: M2-M3 on Young 87.33 NA 0.76 0.4797 0.34
9: M2-M3 on Old 64.50 NA 0.86 0.4267 0.34
10: M3-M4 on Young 14.33 NA 0.12 0.9056 0.05
11: M3-M4 on Old 130.33 NA 3.61 0.0155 0.60
12: M4-M5 on Young -58.00 NA -0.69 0.5203 0.15
13: M4-M5 on Old -48.83 NA -0.80 0.4626 0.14
$DetallMainC
Contr psihat test p.value Psihat2 p.value2 EfSize.V1
1: M1-M2 169.83 2.31 0.0689 89.50 0.104 0.19
2: M2-M3 98.33 0.93 0.3929 193.07 0.004 0.34
3: M3-M4 109.67 0.90 0.4093 114.43 0.196 0.31
4: M4-M5 -97.67 -3.05 0.0284 -95.55 0.080 0.17
$DetallTrialCadaCondAB
Contr psihat df test p.value Psihat2 p.value2 dif.yuen df.yuen
1: M1-M2 on Y_C 86.00 NA 1.12 0.3144 51.71 0.376 51.71 6
2: M1-M2 on Y_SR 25.17 NA 0.59 0.5794 16.29 0.652 16.29 6
3: M1-M2 on O_C 19.17 NA 0.41 0.6982 4.50 0.672 4.50 5
4: M1-M2 on O_SR 32.33 NA 0.51 0.6347 17.00 0.688 17.00 5
5: M2-M3 on Y_C -18.17 NA -0.16 0.8754 -1.57 0.966 -1.57 6
6: M2-M3 on Y_SR 41.67 NA 1.51 0.1921 46.14 0.128 46.14 6
7: M2-M3 on O_C 102.67 NA 1.59 0.1725 121.50 0.000 121.50 5
8: M2-M3 on O_SR 40.50 NA 1.29 0.2535 27.00 0.428 27.00 5
9: M3-M4 on Y_C 16.83 NA 0.31 0.7725 8.19 0.840 19.67 5
10: M3-M4 on Y_SR 32.33 NA 0.99 0.3683 17.57 0.288 17.57 6
11: M3-M4 on O_C -2.67 NA -0.03 0.9793 -6.17 0.930 -6.17 5
12: M3-M4 on O_SR 89.33 NA 3.54 0.0165 94.83 0.004 88.67 5
13: M4-M5 on Y_C 10.33 NA 0.22 0.8362 7.67 0.806 7.67 5
14: M4-M5 on Y_SR 11.50 NA 0.24 0.8163 29.29 0.414 29.29 6
15: M4-M5 on O_C -61.83 NA -1.78 0.1350 -53.67 0.176 -53.67 5
16: M4-M5 on O_SR -64.33 NA -1.17 0.2960 -78.83 0.052 -78.83 5
test.yuen EffSize.yuen pvaluet.yuen
1: 0.97 0.37 0.3682
2: 0.52 0.17 0.6211
3: 0.19 0.09 0.8562
4: 0.37 0.13 0.7279
5: -0.02 0.01 0.9809
6: 1.93 0.46 0.1020
7: 2.59 0.80 0.0487
8: 0.84 0.26 0.4368
9: 0.65 0.08 0.5441
10: 1.16 0.32 0.2919
11: -0.08 0.03 0.9408
12: 3.74 0.78 0.0134
13: 0.21 0.09 0.8386
14: 0.90 0.31 0.4038
15: -1.24 0.35 0.2696
16: -1.95 0.55 0.1090
$DetallSimple
$DetallSimple[[1]]
$DetallSimple[[1]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.91 0.352 0.91 0.352 1.10 0.3006 0.3589 0.361
2: Sleep 0.14 0.713 0.14 0.713 0.01 0.9305 0.7179 0.700
3: Age*Sleep 0.09 0.773 -0.02 0.920 0.07 0.7992 0.8831 0.770
EffSize
1: 0.23
2: 0.04
3: 0.11
$DetallSimple[[1]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -1.71 11.82 -0.06 0.9535 0.02 0.00 0.9511
2: Sleep on Old -14.17 9.80 -0.45 0.6607 0.16 0.20 0.6822
3: Age on Control -14.00 10.98 -0.47 0.6471 0.24 0.22 0.6596
4: Age on SR -26.45 10.06 -0.87 0.4043 0.36 0.76 0.4067
EffSize.Boot
1: 0.02
2: 0.15
3: 0.20
4: 0.31
$DetallSimple[[1]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -1.71 11.82 -0.06 0.9535 0.02 0.00 0.9556
2: Sleep on Old -14.17 9.80 -0.45 0.6607 0.17 0.20 0.6456
3: Age on Control -14.00 10.98 -0.47 0.6471 0.21 0.22 0.6633
4: Age on SR -26.45 10.06 -0.87 0.4043 0.36 0.76 0.4049
5: YSR vs OC -12.29 10.71 -0.44 0.6694 0.18 0.19 0.6930
EffSize.Boot
1: 0.02
2: 0.15
3: 0.24
4: 0.31
5: 0.15
$DetallSimple[[2]]
$DetallSimple[[2]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 2.43 0.140 2.43 0.140 2.06 0.1603 0.1636 0.132
2: Sleep 0.48 0.498 0.48 0.498 0.52 0.4746 0.5142 0.486
3: Age*Sleep 0.40 0.535 0.04 0.830 0.13 0.7191 NA 0.549
EffSize
1: 0.32
2: 0.16
3: 0.21
$DetallSimple[[2]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -37.14 8.97 -0.84 0.4218 0.28 0.71 0.4156
2: Sleep on Old -1.67 5.60 -0.05 0.9628 0.07 0.00 0.9678
3: Age on Control -61.21 6.52 -1.53 0.1737 0.45 2.33 0.1689
4: Age on SR -25.74 8.42 -0.66 0.5253 0.19 0.44 0.5267
EffSize.Boot
1: 0.28
2: 0.11
3: 0.46
4: 0.22
$DetallSimple[[2]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -37.14 8.97 -0.84 0.4218 0.28 0.71 0.4122
2: Sleep on Old -1.67 5.60 -0.05 0.9628 0.08 0.00 0.9611
3: Age on Control -61.21 6.52 -1.53 0.1737 0.48 2.33 0.1913
4: Age on SR -25.74 8.42 -0.66 0.5253 0.21 0.44 0.5144
5: YSR vs OC -24.07 7.87 -1.11 0.3014 0.37 1.22 0.3215
EffSize.Boot
1: 0.28
2: 0.06
3: 0.46
4: 0.22
5: 0.38
$DetallSimple[[3]]
$DetallSimple[[3]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.09 0.768 0.09 0.768 0.01 0.9407 0.7195 0.760
2: Sleep 2.33 0.153 2.33 0.153 2.28 0.1424 0.1436 0.155
3: Age*Sleep 3.63 0.080 -0.28 0.140 3.41 0.0760 NA 0.087
EffSize
1: 0.08
2: 0.34
3: 0.56
$DetallSimple[[3]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 10.57 7.65 0.31 0.7684 0.10 0.09 0.7556
2: Sleep on Old -96.17 5.34 -2.18 0.0771 0.79 4.77 0.1013
3: Age on Control 61.86 9.66 1.14 0.2804 0.39 1.31 0.2678
4: Age on SR -44.88 10.08 -3.09 0.0114 0.70 9.52 0.0056
EffSize.Boot
1: 0.10
2: 0.83
3: 0.36
4: 0.71
$DetallSimple[[3]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 10.57 7.65 0.31 0.7684 0.10 0.09 0.7567
2: Sleep on Old -96.17 5.34 -2.18 0.0771 0.79 4.77 0.1148
3: Age on Control 61.86 9.66 1.14 0.2804 0.38 1.31 0.2911
4: Age on SR -44.88 10.08 -3.09 0.0114 0.71 9.52 0.0078
5: YSR vs OC 51.29 5.79 1.14 0.2989 0.51 1.30 0.3059
EffSize.Boot
1: 0.10
2: 0.79
3: 0.36
4: 0.71
5: 0.51
$DetallSimple[[4]]
$DetallSimple[[4]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 2.45 0.151 2.45 0.151 1.09 0.3072 NA 1
2: Sleep 0.24 0.640 0.24 0.640 0.05 0.8199 NA 0 *
3: Age*Sleep 0.09 0.775 -0.21 0.330 1.21 0.2838 NA 0 *
EffSize
1: 0.40
2: 0.15
3: 0.21
$DetallSimple[[4]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 19.95 10.12 1.19 0.2600 0.34 1.42 0.2811
2: Sleep on Old 4.83 6.62 0.10 0.9231 0.03 0.01 0.9121
3: Age on Control 47.50 5.84 1.02 0.3475 0.32 1.04 0.3278
4: Age on SR 32.38 8.16 1.54 0.1618 0.48 2.37 0.1437
EffSize.Boot
1: 0.37
2: 0.03
3: 0.31
4: 0.49
$DetallSimple[[4]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 19.95 10.12 1.19 0.2600 0.37 1.42 0.2722
2: Sleep on Old 4.83 6.62 0.10 0.9231 0.03 0.01 0.9353
3: Age on Control 47.50 5.84 1.02 0.3475 0.30 1.04 0.3215
4: Age on SR 32.38 8.16 1.54 0.1618 0.48 2.37 0.1639
5: YSR vs OC 27.55 5.56 0.60 0.5719 0.22 0.36 0.5322
EffSize.Boot
1: 0.37
2: 0.03
3: 0.33
4: 0.48
5: 0.21
$DetallSimple[[5]]
$DetallSimple[[5]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 2.17 0.157 2.17 0.157 3.92 0.0558 NA 1
2: Sleep 0.12 0.731 0.12 0.731 0.03 0.8542 NA 0 *
3: Age*Sleep 1.04 0.322 -0.18 0.390 2.70 0.1095 NA 0 *
EffSize
1: 0.39
2: 0.16
3: 0.33
$DetallSimple[[5]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 41.57 10.91 1.02 0.3308 0.32 1.04 0.3311
2: Sleep on Old -20.33 8.27 -0.45 0.6628 0.17 0.20 0.6356
3: Age on Control -13.83 9.59 -0.37 0.7181 0.16 0.14 0.6953
4: Age on SR -75.74 9.68 -1.58 0.1469 0.46 2.49 0.1400
EffSize.Boot
1: 0.32
2: 0.17
3: 0.21
4: 0.48
$DetallSimple[[5]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 41.57 10.91 1.02 0.3308 0.32 1.04 0.3144
2: Sleep on Old -20.33 8.27 -0.45 0.6628 0.17 0.20 0.6711
3: Age on Control -13.83 9.59 -0.37 0.7181 0.18 0.14 0.7208
4: Age on SR -75.74 9.68 -1.58 0.1469 0.47 2.49 0.1646
5: YSR vs OC -55.40 10.86 -1.49 0.1646 0.50 2.22 0.1635
EffSize.Boot
1: 0.29
2: 0.17
3: 0.18
4: 0.45
5: 0.53
| Names | Q | p | pBoot | Sig | pBootMas | Sig2 |
|---|---|---|---|---|---|---|
| Age | 1.06 | 0.3042 | 0.3055 | 0.3096 | ||
| Sleep | 0.55 | 0.4567 | 0.4674 | 0.4621 | ||
| Time | 0.90 | 0.4654 | 0.0083 |
|
0.0003 |
|
| Age*Sleep | 3.04 | 0.0814 | 0.0851 | 0.0000 |
|
|
| Age*Time | 0.23 | 0.9237 | 0.1836 | 0.1091 | ||
| Sleep*Time | 0.04 | 0.9973 | 0.8414 | 0.8325 | ||
| AgeSleepTime | 0.07 | 0.9917 | 0.6962 | 0.6316 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on Young | 33.24 | 37.64 | 0.43 | 0.6683 | 0.14 |
| Sleep on Old | -127.50 | 30.19 | -1.39 | 0.1752 | 0.58 |
| Age on Control | 20.31 | 34.13 | 0.21 | 0.8314 | 0.14 |
| Age on SR | -140.43 | 31.17 | -1.91 | 0.0651 | 0.75 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Age on M1 | -40.45 | 20.96 | -0.95 | 0.3523 | 0.24 |
| Age on M2 | -86.95 | 14.56 | -1.56 | 0.1407 | 0.32 |
| Age on M3 | 16.98 | 11.05 | 0.30 | 0.7675 | 0.08 |
| Age on M4 | 79.88 | 8.23 | 1.56 | 0.1552 | 0.40 |
| Age on M5 | -89.57 | 18.17 | -1.47 | 0.1575 | 0.39 |
| M1-M2 on Young | 86.50 | NA | 1.29 | 0.2546 | 0.23 |
| M1-M2 on Old | 69.33 | NA | 0.95 | 0.3837 | 0.11 |
| M2-M3 on Young | 18.00 | NA | 0.21 | 0.8418 | 0.23 |
| M2-M3 on Old | 112.50 | NA | 1.17 | 0.2961 | 0.45 |
| M3-M4 on Young | 55.17 | NA | 0.74 | 0.4903 | 0.19 |
| M3-M4 on Old | 66.00 | NA | 0.74 | 0.4899 | 0.45 |
| M4-M5 on Young | 19.50 | NA | 0.52 | 0.6278 | 0.18 |
| M4-M5 on Old | -130.17 | NA | -1.99 | 0.1026 | 0.51 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on M1 | -15.88 | 20.96 | -0.37 | 0.7125 | 0.04 |
| Sleep on M2 | -38.81 | 14.56 | -0.70 | 0.4978 | 0.16 |
| Sleep on M3 | -85.60 | 11.05 | -1.53 | 0.1546 | 0.34 |
| Sleep on M4 | 24.79 | 8.23 | 0.49 | 0.6400 | 0.16 |
| Sleep on M5 | 21.24 | 18.17 | 0.35 | 0.7307 | 0.16 |
| M1-M2 on Young | 104.83 | NA | 1.24 | 0.2687 | 0.29 |
| M1-M2 on Old | 86.50 | NA | 0.94 | 0.3909 | 0.12 |
| M2-M3 on Young | 87.33 | NA | 0.76 | 0.4797 | 0.34 |
| M2-M3 on Old | 64.50 | NA | 0.86 | 0.4267 | 0.34 |
| M3-M4 on Young | 14.33 | NA | 0.12 | 0.9056 | 0.05 |
| M3-M4 on Old | 130.33 | NA | 3.61 | 0.0155 | 0.60 |
| M4-M5 on Young | -58.00 | NA | -0.69 | 0.5203 | 0.15 |
| M4-M5 on Old | -48.83 | NA | -0.80 | 0.4626 | 0.14 |
| Contr | psihat | test | p.value | Psihat2 | p.value2 | EfSize.V1 |
|---|---|---|---|---|---|---|
| M1-M2 | 169.83 | 2.31 | 0.0689 | 89.50 | 0.104 | 0.19 |
| M2-M3 | 98.33 | 0.93 | 0.3929 | 193.07 | 0.004 | 0.34 |
| M3-M4 | 109.67 | 0.90 | 0.4093 | 114.43 | 0.196 | 0.31 |
| M4-M5 | -97.67 | -3.05 | 0.0284 | -95.55 | 0.080 | 0.17 |
| Contr | psihat | df | test | p.value | Psihat2 | p.value2 | dif.yuen | df.yuen | test.yuen | EffSize.yuen | pvaluet.yuen |
|---|---|---|---|---|---|---|---|---|---|---|---|
| M1-M2 on Y_C | 86.00 | NA | 1.12 | 0.3144 | 51.71 | 0.376 | 51.71 | 6 | 0.97 | 0.37 | 0.3682 |
| M1-M2 on Y_SR | 25.17 | NA | 0.59 | 0.5794 | 16.29 | 0.652 | 16.29 | 6 | 0.52 | 0.17 | 0.6211 |
| M1-M2 on O_C | 19.17 | NA | 0.41 | 0.6982 | 4.50 | 0.672 | 4.50 | 5 | 0.19 | 0.09 | 0.8562 |
| M1-M2 on O_SR | 32.33 | NA | 0.51 | 0.6347 | 17.00 | 0.688 | 17.00 | 5 | 0.37 | 0.13 | 0.7279 |
| M2-M3 on Y_C | -18.17 | NA | -0.16 | 0.8754 | -1.57 | 0.966 | -1.57 | 6 | -0.02 | 0.01 | 0.9809 |
| M2-M3 on Y_SR | 41.67 | NA | 1.51 | 0.1921 | 46.14 | 0.128 | 46.14 | 6 | 1.93 | 0.46 | 0.1020 |
| M2-M3 on O_C | 102.67 | NA | 1.59 | 0.1725 | 121.50 | 0.000 | 121.50 | 5 | 2.59 | 0.80 | 0.0487 |
| M2-M3 on O_SR | 40.50 | NA | 1.29 | 0.2535 | 27.00 | 0.428 | 27.00 | 5 | 0.84 | 0.26 | 0.4368 |
| M3-M4 on Y_C | 16.83 | NA | 0.31 | 0.7725 | 8.19 | 0.840 | 19.67 | 5 | 0.65 | 0.08 | 0.5441 |
| M3-M4 on Y_SR | 32.33 | NA | 0.99 | 0.3683 | 17.57 | 0.288 | 17.57 | 6 | 1.16 | 0.32 | 0.2919 |
| M3-M4 on O_C | -2.67 | NA | -0.03 | 0.9793 | -6.17 | 0.930 | -6.17 | 5 | -0.08 | 0.03 | 0.9408 |
| M3-M4 on O_SR | 89.33 | NA | 3.54 | 0.0165 | 94.83 | 0.004 | 88.67 | 5 | 3.74 | 0.78 | 0.0134 |
| M4-M5 on Y_C | 10.33 | NA | 0.22 | 0.8362 | 7.67 | 0.806 | 7.67 | 5 | 0.21 | 0.09 | 0.8386 |
| M4-M5 on Y_SR | 11.50 | NA | 0.24 | 0.8163 | 29.29 | 0.414 | 29.29 | 6 | 0.90 | 0.31 | 0.4038 |
| M4-M5 on O_C | -61.83 | NA | -1.78 | 0.1350 | -53.67 | 0.176 | -53.67 | 5 | -1.24 | 0.35 | 0.2696 |
| M4-M5 on O_SR | -64.33 | NA | -1.17 | 0.2960 | -78.83 | 0.052 | -78.83 | 5 | -1.95 | 0.55 | 0.1090 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.91 | 0.352 | 0.91 | 0.352 | 1.10 | 0.3006 | 0.3589 | 0.361 | 0.23 | ||
| Sleep | 0.14 | 0.713 | 0.14 | 0.713 | 0.01 | 0.9305 | 0.7179 | 0.700 | 0.04 | ||
| Age*Sleep | 0.09 | 0.773 | -0.02 | 0.920 | 0.07 | 0.7992 | 0.8831 | 0.770 | 0.11 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -1.71 | 11.82 | -0.06 | 0.9535 | 0.02 | 0.00 | 0.9511 | 0.02 |
| Sleep on Old | -14.17 | 9.80 | -0.45 | 0.6607 | 0.16 | 0.20 | 0.6822 | 0.15 |
| Age on Control | -14.00 | 10.98 | -0.47 | 0.6471 | 0.24 | 0.22 | 0.6596 | 0.20 |
| Age on SR | -26.45 | 10.06 | -0.87 | 0.4043 | 0.36 | 0.76 | 0.4067 | 0.31 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -1.71 | 11.82 | -0.06 | 0.9535 | 0.02 | 0.00 | 0.9556 | 0.02 |
| Sleep on Old | -14.17 | 9.80 | -0.45 | 0.6607 | 0.17 | 0.20 | 0.6456 | 0.15 |
| Age on Control | -14.00 | 10.98 | -0.47 | 0.6471 | 0.21 | 0.22 | 0.6633 | 0.24 |
| Age on SR | -26.45 | 10.06 | -0.87 | 0.4043 | 0.36 | 0.76 | 0.4049 | 0.31 |
| YSR vs OC | -12.29 | 10.71 | -0.44 | 0.6694 | 0.18 | 0.19 | 0.6930 | 0.15 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 2.43 | 0.140 | 2.43 | 0.140 | 2.06 | 0.1603 | 0.1636 | 0.132 | 0.32 | ||
| Sleep | 0.48 | 0.498 | 0.48 | 0.498 | 0.52 | 0.4746 | 0.5142 | 0.486 | 0.16 | ||
| Age*Sleep | 0.40 | 0.535 | 0.04 | 0.830 | 0.13 | 0.7191 | NA | 0.549 | 0.21 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -37.14 | 8.97 | -0.84 | 0.4218 | 0.28 | 0.71 | 0.4156 | 0.28 |
| Sleep on Old | -1.67 | 5.60 | -0.05 | 0.9628 | 0.07 | 0.00 | 0.9678 | 0.11 |
| Age on Control | -61.21 | 6.52 | -1.53 | 0.1737 | 0.45 | 2.33 | 0.1689 | 0.46 |
| Age on SR | -25.74 | 8.42 | -0.66 | 0.5253 | 0.19 | 0.44 | 0.5267 | 0.22 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -37.14 | 8.97 | -0.84 | 0.4218 | 0.28 | 0.71 | 0.4122 | 0.28 |
| Sleep on Old | -1.67 | 5.60 | -0.05 | 0.9628 | 0.08 | 0.00 | 0.9611 | 0.06 |
| Age on Control | -61.21 | 6.52 | -1.53 | 0.1737 | 0.48 | 2.33 | 0.1913 | 0.46 |
| Age on SR | -25.74 | 8.42 | -0.66 | 0.5253 | 0.21 | 0.44 | 0.5144 | 0.22 |
| YSR vs OC | -24.07 | 7.87 | -1.11 | 0.3014 | 0.37 | 1.22 | 0.3215 | 0.38 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.09 | 0.768 | 0.09 | 0.768 | 0.01 | 0.9407 | 0.7195 | 0.760 | 0.08 | ||
| Sleep | 2.33 | 0.153 | 2.33 | 0.153 | 2.28 | 0.1424 | 0.1436 | 0.155 | 0.34 | ||
| Age*Sleep | 3.63 | 0.080 | -0.28 | 0.140 | 3.41 | 0.0760 | NA | 0.087 | 0.56 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 10.57 | 7.65 | 0.31 | 0.7684 | 0.10 | 0.09 | 0.7556 | 0.10 |
| Sleep on Old | -96.17 | 5.34 | -2.18 | 0.0771 | 0.79 | 4.77 | 0.1013 | 0.83 |
| Age on Control | 61.86 | 9.66 | 1.14 | 0.2804 | 0.39 | 1.31 | 0.2678 | 0.36 |
| Age on SR | -44.88 | 10.08 | -3.09 | 0.0114 | 0.70 | 9.52 | 0.0056 | 0.71 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 10.57 | 7.65 | 0.31 | 0.7684 | 0.10 | 0.09 | 0.7567 | 0.10 |
| Sleep on Old | -96.17 | 5.34 | -2.18 | 0.0771 | 0.79 | 4.77 | 0.1148 | 0.79 |
| Age on Control | 61.86 | 9.66 | 1.14 | 0.2804 | 0.38 | 1.31 | 0.2911 | 0.36 |
| Age on SR | -44.88 | 10.08 | -3.09 | 0.0114 | 0.71 | 9.52 | 0.0078 | 0.71 |
| YSR vs OC | 51.29 | 5.79 | 1.14 | 0.2989 | 0.51 | 1.30 | 0.3059 | 0.51 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 2.45 | 0.151 | 2.45 | 0.151 | 1.09 | 0.3072 | NA | 1 | 0.40 | ||
| Sleep | 0.24 | 0.640 | 0.24 | 0.640 | 0.05 | 0.8199 | NA | 0 |
|
0.15 | |
| Age*Sleep | 0.09 | 0.775 | -0.21 | 0.330 | 1.21 | 0.2838 | NA | 0 |
|
0.21 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 19.95 | 10.12 | 1.19 | 0.2600 | 0.34 | 1.42 | 0.2811 | 0.37 |
| Sleep on Old | 4.83 | 6.62 | 0.10 | 0.9231 | 0.03 | 0.01 | 0.9121 | 0.03 |
| Age on Control | 47.50 | 5.84 | 1.02 | 0.3475 | 0.32 | 1.04 | 0.3278 | 0.31 |
| Age on SR | 32.38 | 8.16 | 1.54 | 0.1618 | 0.48 | 2.37 | 0.1437 | 0.49 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 19.95 | 10.12 | 1.19 | 0.2600 | 0.37 | 1.42 | 0.2722 | 0.37 |
| Sleep on Old | 4.83 | 6.62 | 0.10 | 0.9231 | 0.03 | 0.01 | 0.9353 | 0.03 |
| Age on Control | 47.50 | 5.84 | 1.02 | 0.3475 | 0.30 | 1.04 | 0.3215 | 0.33 |
| Age on SR | 32.38 | 8.16 | 1.54 | 0.1618 | 0.48 | 2.37 | 0.1639 | 0.48 |
| YSR vs OC | 27.55 | 5.56 | 0.60 | 0.5719 | 0.22 | 0.36 | 0.5322 | 0.21 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 2.17 | 0.157 | 2.17 | 0.157 | 3.92 | 0.0558 | NA | 1 | 0.39 | ||
| Sleep | 0.12 | 0.731 | 0.12 | 0.731 | 0.03 | 0.8542 | NA | 0 |
|
0.16 | |
| Age*Sleep | 1.04 | 0.322 | -0.18 | 0.390 | 2.70 | 0.1095 | NA | 0 |
|
0.33 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 41.57 | 10.91 | 1.02 | 0.3308 | 0.32 | 1.04 | 0.3311 | 0.32 |
| Sleep on Old | -20.33 | 8.27 | -0.45 | 0.6628 | 0.17 | 0.20 | 0.6356 | 0.17 |
| Age on Control | -13.83 | 9.59 | -0.37 | 0.7181 | 0.16 | 0.14 | 0.6953 | 0.21 |
| Age on SR | -75.74 | 9.68 | -1.58 | 0.1469 | 0.46 | 2.49 | 0.1400 | 0.48 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 41.57 | 10.91 | 1.02 | 0.3308 | 0.32 | 1.04 | 0.3144 | 0.29 |
| Sleep on Old | -20.33 | 8.27 | -0.45 | 0.6628 | 0.17 | 0.20 | 0.6711 | 0.17 |
| Age on Control | -13.83 | 9.59 | -0.37 | 0.7181 | 0.18 | 0.14 | 0.7208 | 0.18 |
| Age on SR | -75.74 | 9.68 | -1.58 | 0.1469 | 0.47 | 2.49 | 0.1646 | 0.45 |
| YSR vs OC | -55.40 | 10.86 | -1.49 | 0.1646 | 0.50 | 2.22 | 0.1635 | 0.53 |
# Command selection. Copy the rest of the lines of code from the chunk of the reference figure and in the same order.
# Fig 7F Duration during recovery {Design 2x2x((5+1)xS)
# As Fig. 7E
rrt<-ExDataIS.2(nmF = NmFich,Vars = ,c(4,5,7,15:20),vIntP =c(4:9),lvlCh = list("Hr 1"="Avg_SpindleDuration_NREM_1", "Hr 2"="Avg_SpindleDuration_NREM_2","Hr 3"="Avg_SpindleDuration_NREM_3","Hr 4"="Avg_SpindleDuration_NREM_4","Hr 5"="Avg_SpindleDuration_NREM_5","Total"="Avg_SpindleDuration_NREM_TT"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Spindle Characteristics", "","Spindle Duration (s)"),ylmP =c(0,3),hLin = F,lvIp = 6)
#AOV 1 Global
rrt<-ExData.2(nmF =NmFich,Vars = c(4,5,20))
#AOV 2 For Time Details
rrt2<-ExDataIS.2(nmF = NmFich,Vars = c(4,5,7,15:19),vIntP =c(4:8),lvlCh = list("Hr 1"="Avg_SpindleDuration_NREM_1", "Hr 2"="Avg_SpindleDuration_NREM_2","Hr 3"="Avg_SpindleDuration_NREM_3","Hr 4"="Avg_SpindleDuration_NREM_4","Hr 5"="Avg_SpindleDuration_NREM_5"))
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt2,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
# Fig 7G Frequency during recovery {Design 2x2x((5+1)xS)
# As Fig. 7E
rrt<-ExDataIS.2(nmF = NmFich,Vars = ,c(4,5,7,21:26),vIntP =c(4:9),lvlCh = list("Hr 1"="Avg_SpindleHz_NREM_1", "Hr 2"="Avg_SpindleHz_NREM_2","Hr 3"="Avg_SpindleHz_NREM_3","Hr 4"="Avg_SpindleHz_NREM_4","Hr 5"="Avg_SpindleHz_NREM_5","Total"="Avg_SpindleHz_NREM_TT"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Spindle Characteristics", "","Spindle Frequency (Hz)"),ylmP =c(10,12),hLin = F,lvIp = 6)
#AOV 1 Global
rrt<-ExData.2(nmF = NmFich,Vars = c(4,5,26))
#AOV 2 For Time Details
rrt2<-ExDataIS.2(nmF = NmFich,Vars = c(4,5,7,21:25),vIntP =c(4:8),lvlCh = list("Hr 1"="Avg_SpindleHz_NREM_1", "Hr 2"="Avg_SpindleHz_NREM_2","Hr 3"="Avg_SpindleHz_NREM_3","Hr 4"="Avg_SpindleHz_NREM_4","Hr 5"="Avg_SpindleHz_NREM_5"))
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt2,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)Figure 8. Total spindle counts during NREM/REM sigma transitions correlate with memory performance. A-F) Plots showing NREM/REM sigma transitions and associated average spindle counts during the same transitions for controls during post-learning (A-B) and experimental and controls groups during recovery (C-F). G-H) Total spindle counts during the NREM/REM sigma transitions during post-learning (G) and recovery (H).I) Correlations between OPR memory performance and spindle counts during NREM/REM sigma transitions. Young control (n=11), young SD (n=11), old control (n=8), old SD (n=10). Asterisks (*) represent significance using alpha=0.05. Statistical details in Supplemental Statistical Table corresponding to Figure 8.
NmBas="Fig8G SpinTransPostL"
NmFich<-paste0(PathDesign,"SpindleTransitionPostL.csv");
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
DatDTFull <- data.table(read.table(NmFich, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
DatDT<-DatDTFull[,c(3,7,9:10)]
setnames(DatDT, "fullname", "Subject")
DatDT$Group<-factor(DatDT$Group);levels(DatDT$Group) <- list("Young Control"="Young_C", "Old Control"="Old_C")
DatDT$Group<-relevel(DatDT$Group,"Young Control")
DatDT$Subject<-factor(DatDT$Subject)
setkey(DatDT,Group)
VIntra=3:4
NmIntra=names(DatDT[,VIntra,with=F])
ExtendDT<-reshape(DatDT,direction = "long",varying = list(3:4),idvar = "Subject",
timevar=c("Moment"),times=NmIntra)
colnames(ExtendDT)[4] <- "DepVar"
ExtendDT$Group<-factor(ExtendDT$Group);ExtendDT$Group<-relevel(ExtendDT$Group,"Young Control")
ExtendDT$Moment<-factor(ExtendDT$Moment)
levels(ExtendDT$Moment)<-list("-60 sec to 0"="sum_before", "0 to +60 sec"="sum_after")
ExtendDT$Group<-relevel(ExtendDT$Group,"Young Control")
ArP<-unlist(lapply(1:2, function (x) lapply(3:4, function(y) DatDT[.(levels(DatDT$Group)[x]),y,with=F][[1]])),recursive = F)
Grp<- Grph.3.2Intra(DatP = ExtendDT,"OPR",LblsP =c("Object Exploration", "","Sum of Spindle Counts"),ylmP =c(0,50),hLin = F,lvIp = 2,wMain = F)
levBp<-seq(0.7, 5, by=0.2)
Grp2<- Grp +
geom_signif(annotation=c("","","*"),
y_position=c(2,2,1),
xmin=c(levBp[1],levBp[1+5], mean(levBp[c(1,4)])),
xmax=c(levBp[4],levBp[4+5], mean(levBp[c(1+5,4+5)])),
tip_length = c(-0.02, -0.02),vjust=2,textsize=10)
# AOV Omnibus
ResRo<-list()
RsRb<-bwtrim(2,2,ArP)
ResRo$w<- c(RsRb$Qa.p.value, RsRb$Qb.p.value, RsRb$Qab.p.value)
ResRo$BT<-try(c(bwtrimbt(2,2,ArP)))
APA.N1<-c(round(unlist(RsRb),4),round(unlist(ResRo$BT),4))
rr<-ExtrSig(ResRo$BT)
#print(rr)
ResRo$BT_MM<-c(bwtrimbt(2,2,ArP,nboot = 10000))
rr2=ExtrSig(ResRo$BT_MM)
#print(rr2)
TamA=round(ESmainMCP(2,2,ArP)$Factor.A[3],3)
TamB=round(mean(ESmainMCP(2,2,ArP)$Factor.B[,3]),3)
TamInt=round(mean(esImcp(2,2,ArP)$Effect.Sizes),3)
ExRsRbp<-with(RsRb, round(c(Qa.p.value, Qb.p.value,Qab.p.value),4))
ExRsRbQ<-with(RsRb, round(c(Qa, Qb, Qab),4))
ExFn<-data.table(ExRsRbQ,ExRsRbp,rr$p.V1,rr$p.Sig,rr2$p.V1,rr2$p.Sig)
names(ExFn)<-c("Q","p","pBoot","Sig","pBootMas","Sig2")
ResGen2<-list()
ResGen2[[1]]<-data.table(Names=c("Age","Phase","Age*Phase"),ExFn)
ResGen2[[1]][,EffSize:=c(TamA,TamB,TamInt)]
AlmacenGen2(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen2,PathDesignP = PathDesign,NmBasP = NmBas,Typ=1)
ExtendDTCol<-copy(ExtendDT)
ExtendDTCol$Moment<-"All"
ExtendDTCol<-data.table(rbind(ExtendDT,ExtendDTCol))
Grp3<- Grph.3.2Intra(DatP = ExtendDTCol,"OPR",LblsP =c("Object Exploration", "A","Sum of spindle counts"),ylmP =c(0,50),hLin = F,lvIp = 3,wMain = T)
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
dev.off()
#Results
plot(Grp)
plot(Grp2)
plot(Grp3)
ResGen2
Kbl3(ResGen2[[1]], "Omnibus AOV. Design 2x2")[1] "Taking bootstrap samples. Please wait."
[1] "Taking bootstrap samples. Please wait."
quartz_off_screen
2
[[1]]
Names Q p pBoot Sig pBootMas Sig2 EffSize
1: Age 0.9365 0.3569 0.3873 0.3642 0.226
2: Phase 52.8448 0.0000 0.0000 * 0.0001 * 0.933
3: Age*Phase 0.2552 0.6228 0.5993 0.6179 0.186
| Names | Q | p | pBoot | Sig | pBootMas | Sig2 | EffSize |
|---|---|---|---|---|---|---|---|
| Age | 0.9365 | 0.3569 | 0.3873 | 0.3642 | 0.226 | ||
| Phase | 52.8448 | 0.0000 | 0.0000 |
|
0.0001 |
|
0.933 |
| Age*Phase | 0.2552 | 0.6228 | 0.5993 | 0.6179 | 0.186 |
NmBas="Fig8H SpinTransRecover"
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
ResGen<-NA
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"SpindleTransitionRecover.csv"),Vars = c(4,5,7,9:10),vIntP =c(4:5),lvlCh = list("T1"="sum_before","T2"="sum_after"))
DatDT<-rrt$DT
ArP<-rrt$Arp
ExtendDT<-rrt$ExtendDT
# For Simple Effects:
DatEfS<-list()
for(is in 1:2) {
DatEfS[[is]]<-ExData.2(nmF = paste0(PathDesign,"SpindleTransitionRecover.csv"),Vars = c(4:5,(8+is)))
names(DatEfS[[is]]$DT)[3]<-"DepV"
}
ExtendDTv2<-copy(ExtendDT)
levels(ExtendDTv2$Moment) <- list("-60 sec to 0"="T1", "0 to +60 sec"="T2")
Grp<- Grph.3(DatP = ExtendDTv2,"OPR",LblsP =c("Object Exploration", "","Sum of Spindle Counts"),ylmP =c(0,50),hLin = F,lvIp = 2,wMain = F)
levBp<-seq(0.7, 5, by=0.2)
Grp2<- Grp +
geom_signif(annotation=c("*"),
y_position=c(48),
xmin=c(levBp[1]),
xmax=c(levBp[2]),
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10) +
geom_signif(annotation=c("*"),
y_position=c(45),
xmin=c(levBp[2]),
xmax=c(levBp[4]),
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10) +
geom_signif(annotation=c("*"),
y_position=c(48),
xmin=c(levBp[1+5]),
xmax=c(levBp[2+5]),
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10) +
geom_signif(annotation=c("*"),
y_position=c(45),
xmin=c(levBp[2+5]),
xmax=c(levBp[4+5]),
tip_length = c(0.02, 0.02),vjust=0.5,textsize=10) +
geom_signif(annotation=c("","","*"),
y_position=c(2,2,1),
xmin=c(levBp[1],levBp[1+5], mean(levBp[c(1,4)])),
xmax=c(levBp[4],levBp[4+5], mean(levBp[c(1+5,4+5)])),
tip_length = c(-0.02, -0.02),vjust=2,textsize=10)
#AOV
#A=2;B=2;C=2;DatPas=rrt;DatEfSp=DatEfS;nBMM1=nBMM2=1000;Prc = 2
names(rrt$DT)[4:5]<-c("T1","T2")
ResGen<-AOVMx2.2(A=2,B=2,C=2,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
AlmacenGen2(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign,NmBasP = NmBas,Typ=2)
# Other Graphs
GrpO<-Grph.3.Otros(ExtendDT,LblsP =c("Object Exploration", "A","Similarity Score"))
ExtendDTCol<-copy(ExtendDTv2)
ExtendDTCol$Moment<-"All"
ExtendDTCol<-data.table(rbind(ExtendDTv2,ExtendDTCol))
Grp3<-Grph.3(DatP = ExtendDTCol,"OPR",LblsP =c("Object Exploration", "A","Sum of spindle counts"),ylmP =c(0,50),hLin = F,lvIp = 3,wMain = T)
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
GrpO
dev.off()
# Results
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
plot(Grp3)
GrpO
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResPas = ResGen[[1]], lbl = "Omnibus AOV. Design 2x2x(2xS)");cat("\n")
Kbl3(ResGen[[2]], "Interaction Age-Sleep. Design 2x2x(2xS)")
Kbl3(ResGen[[3]], "Interaction Age-Time. Design 2x2x(2xS)")
Kbl3(ResGen[[4]], "Interaction Sleep-Time. Design 2x2x(2xS)")
Kbl3(ResGen[[5]], "Main Effect Time. Design 2x2x(2xS)")
Kbl3(ResGen[[6]], "Simple Effect Time each Age-Sleep condition. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[1]][[1]], "Simple Effect Age-Sleep on Time=1 Omnibus AOV. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[1]][[2]], "Simple Effect Age-Sleep on Time=1 Simple Effects. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[1]][[3]], "Simple Effect Age-Sleep on Time=1 Extense Simple Effects. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[2]][[1]], "Simple Effect Age-Sleep on Time=2 Omnibus AOV. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[2]][[2]], "Simple Effect Age-Sleep on Time=2 Simple Effects. Design 2x2x(2xS)")
Kbl3(ResGen[[7]][[2]][[3]], "Simple Effect Age-Sleep on Time=2 Extense Simple Effects. Design 2x2x(2xS)") Eff p.V1 p.Sig
1: p.value.A 0.0818
2: p.value.B 0.1619
3: p.value.C 0.0000 *
4: p.value.AB 0.0401 *
5: p.value.AC 0.3072
6: p.value.BC 0.8381
7: p.value.ABC 0.3856
Eff p.V1 p.Sig
1: p.value.A 0.0685
2: p.value.B 0.1835
3: p.value.C 0.0000 *
4: p.value.AB 0.0382 *
5: p.value.AC 0.3018
6: p.value.BC 0.8315
7: p.value.ABC 0.3747
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "This version returns an effect size similar to what is used by yuenv2"
[1] "To get a measure of effect size based on the difference scores, use trimciv2"
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
quartz_off_screen
2
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
$AOV
Names Q p pBoot Sig pBootMas Sig2
1: Age 3.33 0.0682 0.0818 0.0685
2: Sleep 1.80 0.1805 0.1619 0.1835
3: Time 259.31 0.0000 0.0000 * 0.0000 *
4: Age*Sleep 4.38 0.0366 0.0401 * 0.0382 *
5: Age*Time 1.08 0.2998 0.3072 0.3018
6: Sleep*Time 0.05 0.8271 0.8381 0.8315
7: Age*Sleep*Time 0.79 0.3730 0.3856 0.3747
$InterAB
Contr psihat df test p.value EfSize.V1
1: Sleep on Young 12.35 17.24 2.70 0.0152 0.76
2: Sleep on Old -2.71 16.32 -0.54 0.5948 0.23
3: Age on Control 0.96 17.98 0.25 0.8090 0.13
4: Age on SR -14.10 18.50 -2.55 0.0198 0.98
$InterAC
Contr psihat df test p.value EfSize.V1
1: Age on M1 -9.85 16.98 -1.93 0.0701 0.56
2: Age on M2 -3.29 16.65 -0.74 0.4717 0.24
3: M1-M2 on Young 45.70 NA 12.15 0.0001 0.94
4: M1-M2 on Old 48.53 NA 6.70 0.0011 0.96
$InterBC
Contr psihat df test p.value EfSize.V1
1: Sleep on M1 4.13 16.98 0.81 0.4288 0.21
2: Sleep on M2 5.51 16.65 1.23 0.2341 0.37
3: M1-M2 on Control 48.46 NA 12.39 0.0001 0.98
4: M1-M2 on SR 44.46 NA 5.09 0.0038 0.94
$DetallMainC
Contr psihat test p.value Psihat2 p.value2 EfSize.V1
1: M1-M2 91.91 8.3 4e-04 101.85 0 0.97
$DetallTrialCadaCondAB
Contr psihat df test p.value Psihat2 p.value2 dif.yuen df.yuen
1: M1-M2 on Y_C 23.72 NA 5.61 0.0025 24.89 0 24.89 5
2: M1-M2 on Y_SR 20.55 NA 5.15 0.0036 22.76 0 22.76 6
3: M1-M2 on O_C 24.33 NA 10.20 0.0002 25.35 0 25.35 5
4: M1-M2 on O_SR 24.87 NA 4.62 0.0057 28.86 0 28.86 5
test.yuen EffSize.yuen pvaluet.yuen
1: 9.46 0.99 0.0002
2: 5.77 0.94 0.0012
3: 13.32 0.97 0.0000
4: 7.74 0.85 0.0006
$DetallSimple
$DetallSimple[[1]]
$DetallSimple[[1]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 3.74 0.069 3.74 0.069 3.38 0.0752 0.0968 0.067
2: Sleep 0.66 0.429 0.66 0.429 0.63 0.4339 0.4424 0.390
3: Age*Sleep 4.12 0.057 -0.36 0.060 4.18 0.0491 0.1319 0.047 *
EffSize
1: 0.57
2: 0.18
3: 0.61
$DetallSimple[[1]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 7.24 10.11 1.88 0.0895 0.60 3.53 0.1011
2: Sleep on Old -3.11 6.90 -0.93 0.3822 0.30 0.87 0.3567
3: Age on Control 0.25 8.45 0.10 0.9239 0.13 0.01 0.9255
4: Age on SR -10.10 10.98 -2.28 0.0433 0.52 5.21 0.0512
EffSize.Boot
1: 0.60
2: 0.29
3: 0.11
4: 1.03
$DetallSimple[[1]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 7.24 10.11 1.88 0.0895 0.60 3.53 0.1056
2: Sleep on Old -3.11 6.90 -0.93 0.3822 0.31 0.87 0.3822
3: Age on Control 0.25 8.45 0.10 0.9239 0.14 0.01 0.9333
4: Age on SR -10.10 10.98 -2.28 0.0433 0.56 5.21 0.0622
5: YSR vs OC -6.99 8.02 -2.01 0.0795 0.60 4.03 0.0868
EffSize.Boot
1: 0.60
2: 0.31
3: 0.14
4: 1.04
5: 0.61
$DetallSimple[[2]]
$DetallSimple[[2]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.54 0.472 0.54 0.472 0.82 0.3723 0.4858 0.470
2: Sleep 1.52 0.234 1.52 0.234 3.09 0.0884 0.2354 0.238
3: Age*Sleep 1.11 0.306 -0.21 0.250 1.28 0.2659 0.4240 0.304
EffSize
1: 0.23
2: 0.38
3: 0.38
$DetallSimple[[2]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 5.11 10.12 2.07 0.0654 0.68 4.27 0.0556
2: Sleep on Old 0.40 9.46 0.11 0.9163 0.10 0.01 0.9211
3: Age on Control 0.71 9.70 0.24 0.8169 0.15 0.06 0.8263
4: Age on SR -4.00 7.74 -1.21 0.2635 0.47 1.45 0.2744
EffSize.Boot
1: 0.68
2: 0.10
3: 0.17
4: 0.46
$DetallSimple[[2]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 5.11 10.12 2.07 0.0654 0.68 4.27 0.0433
2: Sleep on Old 0.40 9.46 0.11 0.9163 0.10 0.01 0.9143
3: Age on Control 0.71 9.70 0.24 0.8169 0.20 0.06 0.8333
4: Age on SR -4.00 7.74 -1.21 0.2635 0.46 1.45 0.2344
5: YSR vs OC -4.40 9.09 -1.59 0.1468 0.70 2.52 0.1435
EffSize.Boot
1: 0.68
2: 0.10
3: 0.19
4: 0.46
5: 0.69
| Names | Q | p | pBoot | Sig | pBootMas | Sig2 |
|---|---|---|---|---|---|---|
| Age | 3.33 | 0.0682 | 0.0818 | 0.0685 | ||
| Sleep | 1.80 | 0.1805 | 0.1619 | 0.1835 | ||
| Time | 259.31 | 0.0000 | 0.0000 |
|
0.0000 |
|
| Age*Sleep | 4.38 | 0.0366 | 0.0401 |
|
0.0382 |
|
| Age*Time | 1.08 | 0.2998 | 0.3072 | 0.3018 | ||
| Sleep*Time | 0.05 | 0.8271 | 0.8381 | 0.8315 | ||
| AgeSleepTime | 0.79 | 0.3730 | 0.3856 | 0.3747 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on Young | 12.35 | 17.24 | 2.70 | 0.0152 | 0.76 |
| Sleep on Old | -2.71 | 16.32 | -0.54 | 0.5948 | 0.23 |
| Age on Control | 0.96 | 17.98 | 0.25 | 0.8090 | 0.13 |
| Age on SR | -14.10 | 18.50 | -2.55 | 0.0198 | 0.98 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Age on M1 | -9.85 | 16.98 | -1.93 | 0.0701 | 0.56 |
| Age on M2 | -3.29 | 16.65 | -0.74 | 0.4717 | 0.24 |
| M1-M2 on Young | 45.70 | NA | 12.15 | 0.0001 | 0.94 |
| M1-M2 on Old | 48.53 | NA | 6.70 | 0.0011 | 0.96 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on M1 | 4.13 | 16.98 | 0.81 | 0.4288 | 0.21 |
| Sleep on M2 | 5.51 | 16.65 | 1.23 | 0.2341 | 0.37 |
| M1-M2 on Control | 48.46 | NA | 12.39 | 0.0001 | 0.98 |
| M1-M2 on SR | 44.46 | NA | 5.09 | 0.0038 | 0.94 |
| Contr | psihat | test | p.value | Psihat2 | p.value2 | EfSize.V1 |
|---|---|---|---|---|---|---|
| M1-M2 | 91.91 | 8.3 | 4e-04 | 101.85 | 0 | 0.97 |
| Contr | psihat | df | test | p.value | Psihat2 | p.value2 | dif.yuen | df.yuen | test.yuen | EffSize.yuen | pvaluet.yuen |
|---|---|---|---|---|---|---|---|---|---|---|---|
| M1-M2 on Y_C | 23.72 | NA | 5.61 | 0.0025 | 24.89 | 0 | 24.89 | 5 | 9.46 | 0.99 | 0.0002 |
| M1-M2 on Y_SR | 20.55 | NA | 5.15 | 0.0036 | 22.76 | 0 | 22.76 | 6 | 5.77 | 0.94 | 0.0012 |
| M1-M2 on O_C | 24.33 | NA | 10.20 | 0.0002 | 25.35 | 0 | 25.35 | 5 | 13.32 | 0.97 | 0.0000 |
| M1-M2 on O_SR | 24.87 | NA | 4.62 | 0.0057 | 28.86 | 0 | 28.86 | 5 | 7.74 | 0.85 | 0.0006 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 3.74 | 0.069 | 3.74 | 0.069 | 3.38 | 0.0752 | 0.0968 | 0.067 | 0.57 | ||
| Sleep | 0.66 | 0.429 | 0.66 | 0.429 | 0.63 | 0.4339 | 0.4424 | 0.390 | 0.18 | ||
| Age*Sleep | 4.12 | 0.057 | -0.36 | 0.060 | 4.18 | 0.0491 | 0.1319 | 0.047 |
|
0.61 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 7.24 | 10.11 | 1.88 | 0.0895 | 0.60 | 3.53 | 0.1011 | 0.60 |
| Sleep on Old | -3.11 | 6.90 | -0.93 | 0.3822 | 0.30 | 0.87 | 0.3567 | 0.29 |
| Age on Control | 0.25 | 8.45 | 0.10 | 0.9239 | 0.13 | 0.01 | 0.9255 | 0.11 |
| Age on SR | -10.10 | 10.98 | -2.28 | 0.0433 | 0.52 | 5.21 | 0.0512 | 1.03 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 7.24 | 10.11 | 1.88 | 0.0895 | 0.60 | 3.53 | 0.1056 | 0.60 |
| Sleep on Old | -3.11 | 6.90 | -0.93 | 0.3822 | 0.31 | 0.87 | 0.3822 | 0.31 |
| Age on Control | 0.25 | 8.45 | 0.10 | 0.9239 | 0.14 | 0.01 | 0.9333 | 0.14 |
| Age on SR | -10.10 | 10.98 | -2.28 | 0.0433 | 0.56 | 5.21 | 0.0622 | 1.04 |
| YSR vs OC | -6.99 | 8.02 | -2.01 | 0.0795 | 0.60 | 4.03 | 0.0868 | 0.61 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.54 | 0.472 | 0.54 | 0.472 | 0.82 | 0.3723 | 0.4858 | 0.470 | 0.23 | ||
| Sleep | 1.52 | 0.234 | 1.52 | 0.234 | 3.09 | 0.0884 | 0.2354 | 0.238 | 0.38 | ||
| Age*Sleep | 1.11 | 0.306 | -0.21 | 0.250 | 1.28 | 0.2659 | 0.4240 | 0.304 | 0.38 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 5.11 | 10.12 | 2.07 | 0.0654 | 0.68 | 4.27 | 0.0556 | 0.68 |
| Sleep on Old | 0.40 | 9.46 | 0.11 | 0.9163 | 0.10 | 0.01 | 0.9211 | 0.10 |
| Age on Control | 0.71 | 9.70 | 0.24 | 0.8169 | 0.15 | 0.06 | 0.8263 | 0.17 |
| Age on SR | -4.00 | 7.74 | -1.21 | 0.2635 | 0.47 | 1.45 | 0.2744 | 0.46 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 5.11 | 10.12 | 2.07 | 0.0654 | 0.68 | 4.27 | 0.0433 | 0.68 |
| Sleep on Old | 0.40 | 9.46 | 0.11 | 0.9163 | 0.10 | 0.01 | 0.9143 | 0.10 |
| Age on Control | 0.71 | 9.70 | 0.24 | 0.8169 | 0.20 | 0.06 | 0.8333 | 0.19 |
| Age on SR | -4.00 | 7.74 | -1.21 | 0.2635 | 0.46 | 1.45 | 0.2344 | 0.46 |
| YSR vs OC | -4.40 | 9.09 | -1.59 | 0.1468 | 0.70 | 2.52 | 0.1435 | 0.69 |
NmBas="Fig8I Correlations"
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
DatDTRes<-list()
NameF<-paste0(PathDesign,"SpindleTransitionRecoverBehavior.csv")
DatDTFullp <- data.table(read.table(NameF, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
DatDTFullp$subtype<-factor(DatDTFullp$subtype)
co<-list()
co$cor<-cor(DatDTFullp[,8:10],use="pairwise.complete.obs")
result <- by(DatDTFullp[,8:10], DatDTFullp$subtype, function(x) {cor(x$sum_before, x$Behavior)})
result.dataframe <- as.data.frame(as.matrix(result))
result.dataframe$C <- rownames(result)
result.dataframe$Grp<-as.factor(c("PostLearning","Recovery","Recovery","PostLearning","Recovery","Recovery"))
DTTibb<-as_tibble(DatDTFullp)
DTTibb$age<-as.factor(DTTibb$age); relevel(DTTibb$age,"Y")
DTTibb$Inter<-interaction(DTTibb$age,DTTibb$type,sep=",")
DTTibb$Inter<-factor(DTTibb$Inter,levels=c("Y,C","Y,D","O,C","O,D"))
DTTibbR<-DTTibb %>%
dplyr::select(period,Inter,sum_before, Behavior) %>%
dplyr::group_by(period,Inter) %>%
dplyr::summarise(R=cor.test(sum_before,Behavior)[["estimate"]],
p=cor.test(sum_before,Behavior)[["p.value"]],.groups = 'drop')
DTTibbR$period<-as.factor(DTTibbR$period)
levels(DTTibbR$period)=list('Post-Learning'='P',"Recovery"='R')
DTTibbR$p<-round(DTTibbR$p,2)
DTTibbR$p<-c('0.03*', '0.06', '0.09', '0.0009*', '0.16', '0.0004*')
pdf(paste0(NmFAlL,NmBas,"Graphs.pdf"),family = "ArialMT")
dotchart(DTTibbR$R, labels = DTTibbR$Inter ,
cex = 1.5, xlab = "",xlim=c(0,1.1),groups = DTTibbR$period,color="black",pch=19)
text(x = DTTibbR$R [c(3,4,5,6,1,2)],
y = c(1:4,7:8),
labels= paste0("p=",DTTibbR$p[c(3,4,5,6,1,2)]),
cex = 1,
pos = 4)
dev.off()
bp<-ggplot(DTTibbR, aes(x = Inter, y = R ))
bpp<-bp + geom_segment( aes(x=Inter,xend=Inter, y=0, yend=R), color="grey") +
geom_point(size=5, color=c("blue","blue","red","red","red","red")) +
coord_flip() +
theme_ipsum() +
theme(
panel.grid.minor.y = element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.major.x = element_line(colour = "darkgrey"),
panel.grid.minor.x = element_line(colour = "grey"),
axis.text = element_text( size=48 )
) +
ylim(0,1) +
ylab("") +
xlab("") + ggtitle("") +
annotate("text", x = c(1,3,1,2,3,4)+.15,
y = DTTibbR$R+c(0,0,-.05,-.05,-.05,-.05),
label= paste0("p=",DTTibbR$p))
# Results
# Type 1 Graph Pearson r Correlation
dotchart(DTTibbR$R, labels = DTTibbR$Inter ,
cex = 1.5, xlab = "",xlim=c(0,1.1),groups = DTTibbR$period,color="black",pch=19)
text(x = DTTibbR$R [c(3,4,5,6,1,2)],
y = c(1:4,7:8),
labels= paste0("p=",DTTibbR$p[c(3,4,5,6,1,2)]),
cex = 1,
pos = 4)
# Type 2 Graph Pearson r Correlation
plot(bpp) [1] Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y O O O O O O O O O O O O O O O O
[39] O O Y Y Y Y Y Y Y Y Y O O O O O O O O
Levels: Y O
quartz_off_screen
2
Supplemental Figure 1. Schematic of electrode placement, L-Ratio, and place cell parameters recorded during OPR performance. A) Schematic of electrode placements (red dots) and microphotograph showing sample lesion marking electrode placement in CA1. B) L-ratio for all groups showing no significant differences across trials. C-E) Mean (C), peak (D), and out of field (E) firing rate for all groups across trials. There were no differences in mean or peak firing rate between the groups throughout training (p>0.05). However, there were increases in firing rate that persisted during training (T1 to T3) when the objects were introduced across all groups [MFR: Fw(4)=1.14, p<0.007; PFR: Fw(4)=1.11, p<0.02 . Analysis of simple effects indicated that all groups displayed higher mean and peak firing rate during the first object trial and test trials (MFR: Hab xT1: Zw=1.73, p<0.04; T3 x Test: Zw=3.16, p<0.04; PFR: Hab xT1: Zw=2.08, p<0.02; T3 x Test: Zw=0.96, p<0.05]. No differences were observed in out-of- field firing rate. F-H) There were no differences during training or testing in other place cell parameters, including number of fields (F), field size (G), and spatial information content (H, p>0.05). Hab: habituation, T1-T3: training trials. YC: young control, YSD: young sleep deprived, OC: old control, OSD: old sleep deprived. Asterisks (*) represent significance using alpha=0.05. Statistical details in Supplemental Statistical Table corresponding to Supplemental Figure 1.
NmBas="FigS1C MeanFiringRate"
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
ResGen<-NA
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"Parameters.csv"),Vars = c(1,5,6,7:11),vIntP =c(4:8),lvlCh = list("HAB"="mfr_s1", "T1"="mfr_s2","T2"="mfr_s3","T3"="mfr_s4","Test"="mfr_s5"))
DatDT<-rrt$DT
ArP<-rrt$Arp
ExtendDT<-rrt$ExtendDT
# Simple Effects:
DatEfS<-list()
for(is in 1:5) {
DatEfS[[is]]<-ExData.2(nmF = paste0(PathDesign,"Parameters.csv"),Vars = c(5:6,(6+is)))
names(DatEfS[[is]]$DT)[3]<-"DepV"
}
#Graphs
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Object Exploration", "","Mean FR (Hz)"),ylmP =c(0,1.5),hLin = F,lvIp=5)
levBp<-seq(0.7, 6, by=0.2)
Grp2<- Grp +
geom_signif(annotation=c("","","*"),
y_position=c(1.4,1.4,1.5),
xmin=c(levBp[1],levBp[1+5], mean(levBp[c(1,4)])),
xmax=c(levBp[4],levBp[4+5], mean(levBp[c(1+5,4+5)])),
tip_length = c(0.02, 0.02),textsize=6)+
geom_signif(annotation=c("","","*"),
y_position=c(1.4,1.4,1.5),
xmin=c(levBp[1+15],levBp[1+20], mean(levBp[c(1+15,4+15)])),
xmax=c(levBp[4+15],levBp[4+20], mean(levBp[c(1+20,4+20)])),
tip_length = c(0.02, 0.02),textsize=6)
#AOV
names(rrt$DT)[4:8]<-c("T1","T2","T3","T4","T5")
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
AlmacenGen2(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign,NmBasP = NmBas,Typ=2)
# Other Graphs
GrpO<-Grph.3.Otros(ExtendDT,LblsP =c("Object Exploration", "B","Mean FR (Hz)"))
ExtendDTCol<-copy(ExtendDT)
ExtendDTCol$Moment<-"All"
ExtendDTCol<-data.table(rbind(ExtendDT,ExtendDTCol))
Grp3<-Grph.3(DatP = ExtendDTCol,"OPR",LblsP =c("Object Exploration", "B","Mean FR (Hz)"),ylmP =c(0,1.5),hLin = F,lvIp = 6,wMain = T)
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
GrpO
dev.off()
# Results
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
GrpO
plot(Grp3)
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResPas = ResGen[[1]], lbl = "Omnibus AOV. Design 2x2x(5xS)");cat("\n")
Kbl3(ResGen[[2]], "Interaction Age-Sleep. Design 2x2x(5xS)")
Kbl3(ResGen[[3]], "Interaction Age-Time. Design 2x2x(5xS)")
Kbl3(ResGen[[4]], "Interaction Sleep-Time. Design 2x2x(5xS)")
Kbl3(ResGen[[5]], "Main Effect Time. Design 2x2x(5xS)")
Kbl3(ResGen[[6]], "Simple Effect Time each Age-Sleep condition. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[1]], "Simple Effect Age-Sleep on Time=1 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[2]], "Simple Effect Age-Sleep on Time=1 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[1]][[3]], "Simple Effect Age-Sleep on Time=1 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[1]], "Simple Effect Age-Sleep on Time=2 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[2]], "Simple Effect Age-Sleep on Time=2 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[2]][[3]], "Simple Effect Age-Sleep on Time=2 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[1]], "Simple Effect Age-Sleep on Time=3 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[2]], "Simple Effect Age-Sleep on Time=3 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[3]][[3]], "Simple Effect Age-Sleep on Time=3 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[1]], "Simple Effect Age-Sleep on Time=4 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[2]], "Simple Effect Age-Sleep on Time=4 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[4]][[3]], "Simple Effect Age-Sleep on Time=4 Extense Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[1]], "Simple Effect Age-Sleep on Time=5 Omnibus AOV. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[2]], "Simple Effect Age-Sleep on Time=5 Simple Effects. Design 2x2x(5xS)")
Kbl3(ResGen[[7]][[5]][[3]], "Simple Effect Age-Sleep on Time=5 Extense Simple Effects. Design 2x2x(5xS)") Eff p.V1 p.Sig
1: p.value.A 0.4708
2: p.value.B 0.7696
3: p.value.C 0.0167 *
4: p.value.AB 0.5259
5: p.value.AC 0.5960
6: p.value.BC 0.5643
7: p.value.ABC 0.4925
Eff p.V1 p.Sig
1: p.value.A 0.4880
2: p.value.B 0.7659
3: p.value.C 0.0362 *
4: p.value.AB 0.4798
5: p.value.AC 0.6661
6: p.value.BC 0.6440
7: p.value.ABC 0.5660
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
quartz_off_screen
2
$BP
$Bars
$MargAB
$MargAC
$MargBC
$MargC
$AOV
Names Q p pBoot Sig pBootMas Sig2
1: Age 0.48 0.4886 0.4708 0.4880
2: Sleep 0.09 0.7658 0.7696 0.7659
3: Time 1.14 0.3383 0.0167 * 0.0362 *
4: Age*Sleep 0.37 0.5457 0.5259 0.4798
5: Age*Time 0.25 0.9113 0.5960 0.6661
6: Sleep*Time 0.26 0.9032 0.5643 0.6440
7: Age*Sleep*Time 0.31 0.8731 0.4925 0.5660
$InterAB
Contr psihat df test p.value EfSize.V1
1: Sleep on Young -0.09 287.49 -0.42 0.6731 0.06
2: Sleep on Old 0.26 198.13 1.12 0.2639 0.03
3: Age on Control -0.38 208.58 -1.64 0.1019 0.16
4: Age on SR -0.03 248.53 -0.12 0.9053 0.07
$InterAC
Contr psihat df test p.value EfSize.V1
1: Age on M1 -0.09 81.88 -0.68 0.4994 0.09
2: Age on M2 -0.08 90.03 -0.50 0.6171 0.05
3: Age on M3 -0.11 104.49 -0.73 0.4695 0.08
4: Age on M4 -0.17 97.14 -1.25 0.2153 0.13
5: Age on M5 0.04 93.95 0.33 0.7453 0.05
6: M1-M2 on Young -0.10 NA -1.12 0.2761 0.11
7: M1-M2 on Old -0.06 NA -0.66 0.5151 0.09
8: M2-M3 on Young -0.06 NA -1.04 0.3112 0.02
9: M2-M3 on Old -0.07 NA -0.98 0.3363 0.05
10: M3-M4 on Young 0.11 NA 1.66 0.1125 0.09
11: M3-M4 on Old 0.07 NA 1.20 0.2427 0.07
12: M4-M5 on Young -0.02 NA -0.26 0.7992 0.00
13: M4-M5 on Old 0.29 NA 2.83 0.0100 0.20
$InterBC
Contr psihat df test p.value EfSize.V1
1: Sleep on M1 -0.10 81.88 -0.73 0.4690 0.09
2: Sleep on M2 0.06 90.03 0.34 0.7331 0.03
3: Sleep on M3 0.10 104.49 0.65 0.5187 0.04
4: Sleep on M4 0.08 97.14 0.60 0.5513 0.04
5: Sleep on M5 0.04 93.95 0.31 0.7583 0.04
6: M1-M2 on Young -0.22 NA -3.50 0.0021 0.16
7: M1-M2 on Old -0.01 NA -0.09 0.9285 0.04
8: M2-M3 on Young -0.03 NA -0.31 0.7607 0.03
9: M2-M3 on Old -0.10 NA -1.99 0.0594 0.02
10: M3-M4 on Young 0.11 NA 1.39 0.1779 0.08
11: M3-M4 on Old 0.12 NA 2.12 0.0459 0.08
12: M4-M5 on Young 0.22 NA 2.65 0.0149 0.09
13: M4-M5 on Old 0.15 NA 2.06 0.0518 0.08
$DetallMainC
Contr psihat test p.value Psihat2 p.value2 EfSize.V1
1: M1-M2 -0.19 -1.73 0.0989 -0.27 0.020 0.10
2: M2-M3 -0.21 -2.02 0.0566 -0.09 0.384 0.04
3: M3-M4 0.17 1.32 0.2006 0.20 0.056 0.08
4: M4-M5 0.34 3.16 0.0048 0.23 0.064 0.09
$DetallTrialCadaCondAB
Contr psihat df test p.value Psihat2 p.value2 dif.yuen df.yuen
1: M1-M2 on Y_C -0.08 NA -1.24 0.2282 -0.11 0.040 -0.11 35
2: M1-M2 on Y_SR -0.01 NA -0.23 0.8238 -0.03 0.688 -0.03 29
3: M1-M2 on O_C -0.14 NA -2.96 0.0075 -0.10 0.140 -0.10 21
4: M1-M2 on O_SR 0.04 NA 0.54 0.5967 -0.03 0.700 -0.03 24
5: M2-M3 on Y_C 0.02 NA 0.29 0.7733 0.01 0.852 0.01 35
6: M2-M3 on Y_SR -0.05 NA -1.68 0.1083 -0.04 0.348 -0.04 29
7: M2-M3 on O_C -0.06 NA -0.93 0.3635 -0.07 0.316 -0.07 21
8: M2-M3 on O_SR -0.04 NA -0.92 0.3679 0.02 0.792 0.02 24
9: M3-M4 on Y_C 0.04 NA 0.92 0.3686 0.06 0.124 0.06 35
10: M3-M4 on Y_SR 0.05 NA 1.93 0.0676 0.07 0.012 0.07 29
11: M3-M4 on O_C 0.08 NA 1.78 0.0889 0.05 0.488 0.05 21
12: M3-M4 on O_SR 0.03 NA 0.83 0.4176 0.02 0.664 0.02 24
13: M4-M5 on Y_C 0.01 NA 0.22 0.8258 -0.03 0.628 -0.03 35
14: M4-M5 on Y_SR 0.01 NA 0.29 0.7709 0.04 0.392 0.04 29
15: M4-M5 on O_C 0.19 NA 3.68 0.0014 0.16 0.012 0.16 21
16: M4-M5 on O_SR 0.11 NA 1.64 0.1150 0.06 0.396 0.06 24
test.yuen EffSize.yuen pvaluet.yuen
1: -1.93 0.17 0.0619
2: -0.46 0.04 0.6523
3: -1.40 0.14 0.1765
4: -0.50 0.05 0.6186
5: 0.23 0.01 0.8231
6: -0.94 0.06 0.3542
7: -1.09 0.10 0.2874
8: 0.41 0.03 0.6885
9: 1.39 0.09 0.1748
10: 2.10 0.10 0.0443
11: 0.65 0.08 0.5232
12: 0.41 0.04 0.6857
13: -0.47 0.04 0.6408
14: 0.94 0.06 0.3558
15: 2.28 0.30 0.0329
16: 0.73 0.10 0.4731
$DetallSimple
$DetallSimple[[1]]
$DetallSimple[[1]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.46 0.500 0.46 0.500 0.20 0.6559 0.4891 0.487
2: Sleep 0.53 0.469 0.53 0.469 0.58 0.4490 0.4841 0.469
3: Age*Sleep 0.10 0.753 0.04 0.630 0.14 0.7111 0.8364 0.726
EffSize
1: 0.08
2: 0.10
3: 0.04
$DetallSimple[[1]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.07 63.87 -0.91 0.3644 0.13 0.83 0.3711
2: Sleep on Old -0.03 43.04 -0.25 0.8032 0.04 0.06 0.8144
3: Age on Control -0.07 40.45 -0.66 0.5146 0.12 0.43 0.5200
4: Age on SR -0.02 44.40 -0.28 0.7831 0.04 0.08 0.7833
EffSize.Boot
1: 0.12
2: 0.04
3: 0.12
4: 0.04
$DetallSimple[[1]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.07 63.87 -0.91 0.3644 0.12 0.83 0.3611
2: Sleep on Old -0.03 43.04 -0.25 0.8032 0.04 0.06 0.8122
3: Age on Control -0.07 40.45 -0.66 0.5146 0.13 0.43 0.5622
4: Age on SR -0.02 44.40 -0.28 0.7831 0.05 0.08 0.7733
5: YSR vs OC 0.00 35.64 0.03 0.9732 0.05 0.00 0.9756
EffSize.Boot
1: 0.13
2: 0.05
3: 0.11
4: 0.05
5: 0.04
$DetallSimple[[2]]
$DetallSimple[[2]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.25 0.618 0.25 0.618 0.05 0.8190 0.5843 0.612
2: Sleep 0.12 0.734 0.12 0.734 0.20 0.6554 0.7529 0.745
3: Age*Sleep 0.02 0.895 0.02 0.850 0.00 0.9488 0.9583 0.883
EffSize
1: 0.06
2: 0.03
3: 0.04
$DetallSimple[[2]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.02 63.84 0.15 0.8788 0.04 0.02 0.8800
2: Sleep on Old 0.04 37.10 0.32 0.7471 0.06 0.11 0.7200
3: Age on Control -0.05 45.61 -0.40 0.6876 0.07 0.16 0.6678
4: Age on SR -0.03 52.80 -0.30 0.7676 0.06 0.09 0.7611
EffSize.Boot
1: 0.03
2: 0.05
3: 0.09
4: 0.04
$DetallSimple[[2]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.02 63.84 0.15 0.8788 0.03 0.02 0.8678
2: Sleep on Old 0.04 37.10 0.32 0.7471 0.05 0.11 0.7456
3: Age on Control -0.05 45.61 -0.40 0.6876 0.09 0.16 0.7267
4: Age on SR -0.03 52.80 -0.30 0.7676 0.05 0.09 0.7711
5: YSR vs OC -0.07 42.53 -0.55 0.5874 0.10 0.30 0.5767
EffSize.Boot
1: 0.03
2: 0.06
3: 0.09
4: 0.06
5: 0.08
$DetallSimple[[3]]
$DetallSimple[[3]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.53 0.470 0.53 0.470 0.39 0.5319 0.4658 0.475
2: Sleep 0.42 0.519 0.42 0.519 0.62 0.4330 0.5442 0.525
3: Age*Sleep 1.37 0.245 0.09 0.310 1.10 0.2948 0.2487 0.226
EffSize
1: 0.08
2: 0.04
3: 0.16
$DetallSimple[[3]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.04 61.52 -0.36 0.7193 0.06 0.13 0.7267
2: Sleep on Old 0.13 44.35 1.32 0.1942 0.21 1.74 0.1900
3: Age on Control -0.14 51.58 -1.36 0.1792 0.23 1.85 0.1689
4: Age on SR 0.03 52.94 0.31 0.7579 0.05 0.10 0.7456
EffSize.Boot
1: 0.06
2: 0.21
3: 0.23
4: 0.05
$DetallSimple[[3]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.04 61.52 -0.36 0.7193 0.06 0.13 0.7400
2: Sleep on Old 0.13 44.35 1.32 0.1942 0.21 1.74 0.1967
3: Age on Control -0.14 51.58 -1.36 0.1792 0.22 1.85 0.1889
4: Age on SR 0.03 52.94 0.31 0.7579 0.07 0.10 0.7511
5: YSR vs OC -0.10 49.61 -0.93 0.3549 0.15 0.87 0.3522
EffSize.Boot
1: 0.06
2: 0.22
3: 0.24
4: 0.04
5: 0.14
$DetallSimple[[4]]
$DetallSimple[[4]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 1.56 0.216 1.56 0.216 1.50 0.2225 0.1987 0.233
2: Sleep 0.36 0.552 0.36 0.552 0.70 0.4026 0.5860 0.544
3: Age*Sleep 1.10 0.296 0.09 0.330 0.94 0.3343 0.3489 0.281
EffSize
1: 0.13
2: 0.04
3: 0.16
$DetallSimple[[4]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.03 61.43 -0.33 0.7437 0.05 0.11 0.7778
2: Sleep on Old 0.11 41.58 1.14 0.2613 0.20 1.30 0.2900
3: Age on Control -0.15 45.95 -1.58 0.1218 0.25 2.48 0.1078
4: Age on SR -0.01 52.94 -0.14 0.8866 0.05 0.02 0.9122
EffSize.Boot
1: 0.05
2: 0.19
3: 0.25
4: 0.05
$DetallSimple[[4]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young -0.03 61.43 -0.33 0.7437 0.05 0.11 0.7411
2: Sleep on Old 0.11 41.58 1.14 0.2613 0.19 1.30 0.2689
3: Age on Control -0.15 45.95 -1.58 0.1218 0.24 2.48 0.1300
4: Age on SR -0.01 52.94 -0.14 0.8866 0.04 0.02 0.9078
5: YSR vs OC -0.12 46.87 -1.21 0.2333 0.21 1.46 0.2433
EffSize.Boot
1: 0.05
2: 0.20
3: 0.25
4: 0.04
5: 0.19
$DetallSimple[[5]]
$DetallSimple[[5]]$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.11 0.746 0.11 0.746 0.77 0.3814 0.7496 0.769
2: Sleep 0.10 0.759 0.10 0.759 0.12 0.7285 0.7546 0.742
3: Age*Sleep 0.03 0.856 -0.04 0.680 0.17 0.6835 0.9316 0.854
EffSize
1: 0.06
2: 0.03
3: 0.08
$DetallSimple[[5]]$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.03 61.21 0.38 0.7053 0.05 0.14 0.7211
2: Sleep on Old 0.01 43.45 0.08 0.9346 0.04 0.01 0.9500
3: Age on Control 0.03 50.16 0.40 0.6896 0.09 0.16 0.7156
4: Age on SR 0.01 48.24 0.09 0.9268 0.03 0.01 0.9178
EffSize.Boot
1: 0.06
2: 0.04
3: 0.09
4: 0.03
$DetallSimple[[5]]$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 0.03 61.21 0.38 0.7053 0.06 0.14 0.6833
2: Sleep on Old 0.01 43.45 0.08 0.9346 0.03 0.01 0.9333
3: Age on Control 0.03 50.16 0.40 0.6896 0.07 0.16 0.7078
4: Age on SR 0.01 48.24 0.09 0.9268 0.04 0.01 0.9256
5: YSR vs OC 0.00 49.26 0.01 0.9898 0.05 0.00 0.9967
EffSize.Boot
1: 0.06
2: 0.04
3: 0.08
4: 0.03
5: 0.05
| Names | Q | p | pBoot | Sig | pBootMas | Sig2 |
|---|---|---|---|---|---|---|
| Age | 0.48 | 0.4886 | 0.4708 | 0.4880 | ||
| Sleep | 0.09 | 0.7658 | 0.7696 | 0.7659 | ||
| Time | 1.14 | 0.3383 | 0.0167 |
|
0.0362 |
|
| Age*Sleep | 0.37 | 0.5457 | 0.5259 | 0.4798 | ||
| Age*Time | 0.25 | 0.9113 | 0.5960 | 0.6661 | ||
| Sleep*Time | 0.26 | 0.9032 | 0.5643 | 0.6440 | ||
| AgeSleepTime | 0.31 | 0.8731 | 0.4925 | 0.5660 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on Young | -0.09 | 287.49 | -0.42 | 0.6731 | 0.06 |
| Sleep on Old | 0.26 | 198.13 | 1.12 | 0.2639 | 0.03 |
| Age on Control | -0.38 | 208.58 | -1.64 | 0.1019 | 0.16 |
| Age on SR | -0.03 | 248.53 | -0.12 | 0.9053 | 0.07 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Age on M1 | -0.09 | 81.88 | -0.68 | 0.4994 | 0.09 |
| Age on M2 | -0.08 | 90.03 | -0.50 | 0.6171 | 0.05 |
| Age on M3 | -0.11 | 104.49 | -0.73 | 0.4695 | 0.08 |
| Age on M4 | -0.17 | 97.14 | -1.25 | 0.2153 | 0.13 |
| Age on M5 | 0.04 | 93.95 | 0.33 | 0.7453 | 0.05 |
| M1-M2 on Young | -0.10 | NA | -1.12 | 0.2761 | 0.11 |
| M1-M2 on Old | -0.06 | NA | -0.66 | 0.5151 | 0.09 |
| M2-M3 on Young | -0.06 | NA | -1.04 | 0.3112 | 0.02 |
| M2-M3 on Old | -0.07 | NA | -0.98 | 0.3363 | 0.05 |
| M3-M4 on Young | 0.11 | NA | 1.66 | 0.1125 | 0.09 |
| M3-M4 on Old | 0.07 | NA | 1.20 | 0.2427 | 0.07 |
| M4-M5 on Young | -0.02 | NA | -0.26 | 0.7992 | 0.00 |
| M4-M5 on Old | 0.29 | NA | 2.83 | 0.0100 | 0.20 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Sleep on M1 | -0.10 | 81.88 | -0.73 | 0.4690 | 0.09 |
| Sleep on M2 | 0.06 | 90.03 | 0.34 | 0.7331 | 0.03 |
| Sleep on M3 | 0.10 | 104.49 | 0.65 | 0.5187 | 0.04 |
| Sleep on M4 | 0.08 | 97.14 | 0.60 | 0.5513 | 0.04 |
| Sleep on M5 | 0.04 | 93.95 | 0.31 | 0.7583 | 0.04 |
| M1-M2 on Young | -0.22 | NA | -3.50 | 0.0021 | 0.16 |
| M1-M2 on Old | -0.01 | NA | -0.09 | 0.9285 | 0.04 |
| M2-M3 on Young | -0.03 | NA | -0.31 | 0.7607 | 0.03 |
| M2-M3 on Old | -0.10 | NA | -1.99 | 0.0594 | 0.02 |
| M3-M4 on Young | 0.11 | NA | 1.39 | 0.1779 | 0.08 |
| M3-M4 on Old | 0.12 | NA | 2.12 | 0.0459 | 0.08 |
| M4-M5 on Young | 0.22 | NA | 2.65 | 0.0149 | 0.09 |
| M4-M5 on Old | 0.15 | NA | 2.06 | 0.0518 | 0.08 |
| Contr | psihat | test | p.value | Psihat2 | p.value2 | EfSize.V1 |
|---|---|---|---|---|---|---|
| M1-M2 | -0.19 | -1.73 | 0.0989 | -0.27 | 0.020 | 0.10 |
| M2-M3 | -0.21 | -2.02 | 0.0566 | -0.09 | 0.384 | 0.04 |
| M3-M4 | 0.17 | 1.32 | 0.2006 | 0.20 | 0.056 | 0.08 |
| M4-M5 | 0.34 | 3.16 | 0.0048 | 0.23 | 0.064 | 0.09 |
| Contr | psihat | df | test | p.value | Psihat2 | p.value2 | dif.yuen | df.yuen | test.yuen | EffSize.yuen | pvaluet.yuen |
|---|---|---|---|---|---|---|---|---|---|---|---|
| M1-M2 on Y_C | -0.08 | NA | -1.24 | 0.2282 | -0.11 | 0.040 | -0.11 | 35 | -1.93 | 0.17 | 0.0619 |
| M1-M2 on Y_SR | -0.01 | NA | -0.23 | 0.8238 | -0.03 | 0.688 | -0.03 | 29 | -0.46 | 0.04 | 0.6523 |
| M1-M2 on O_C | -0.14 | NA | -2.96 | 0.0075 | -0.10 | 0.140 | -0.10 | 21 | -1.40 | 0.14 | 0.1765 |
| M1-M2 on O_SR | 0.04 | NA | 0.54 | 0.5967 | -0.03 | 0.700 | -0.03 | 24 | -0.50 | 0.05 | 0.6186 |
| M2-M3 on Y_C | 0.02 | NA | 0.29 | 0.7733 | 0.01 | 0.852 | 0.01 | 35 | 0.23 | 0.01 | 0.8231 |
| M2-M3 on Y_SR | -0.05 | NA | -1.68 | 0.1083 | -0.04 | 0.348 | -0.04 | 29 | -0.94 | 0.06 | 0.3542 |
| M2-M3 on O_C | -0.06 | NA | -0.93 | 0.3635 | -0.07 | 0.316 | -0.07 | 21 | -1.09 | 0.10 | 0.2874 |
| M2-M3 on O_SR | -0.04 | NA | -0.92 | 0.3679 | 0.02 | 0.792 | 0.02 | 24 | 0.41 | 0.03 | 0.6885 |
| M3-M4 on Y_C | 0.04 | NA | 0.92 | 0.3686 | 0.06 | 0.124 | 0.06 | 35 | 1.39 | 0.09 | 0.1748 |
| M3-M4 on Y_SR | 0.05 | NA | 1.93 | 0.0676 | 0.07 | 0.012 | 0.07 | 29 | 2.10 | 0.10 | 0.0443 |
| M3-M4 on O_C | 0.08 | NA | 1.78 | 0.0889 | 0.05 | 0.488 | 0.05 | 21 | 0.65 | 0.08 | 0.5232 |
| M3-M4 on O_SR | 0.03 | NA | 0.83 | 0.4176 | 0.02 | 0.664 | 0.02 | 24 | 0.41 | 0.04 | 0.6857 |
| M4-M5 on Y_C | 0.01 | NA | 0.22 | 0.8258 | -0.03 | 0.628 | -0.03 | 35 | -0.47 | 0.04 | 0.6408 |
| M4-M5 on Y_SR | 0.01 | NA | 0.29 | 0.7709 | 0.04 | 0.392 | 0.04 | 29 | 0.94 | 0.06 | 0.3558 |
| M4-M5 on O_C | 0.19 | NA | 3.68 | 0.0014 | 0.16 | 0.012 | 0.16 | 21 | 2.28 | 0.30 | 0.0329 |
| M4-M5 on O_SR | 0.11 | NA | 1.64 | 0.1150 | 0.06 | 0.396 | 0.06 | 24 | 0.73 | 0.10 | 0.4731 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.46 | 0.500 | 0.46 | 0.500 | 0.20 | 0.6559 | 0.4891 | 0.487 | 0.08 | ||
| Sleep | 0.53 | 0.469 | 0.53 | 0.469 | 0.58 | 0.4490 | 0.4841 | 0.469 | 0.10 | ||
| Age*Sleep | 0.10 | 0.753 | 0.04 | 0.630 | 0.14 | 0.7111 | 0.8364 | 0.726 | 0.04 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.07 | 63.87 | -0.91 | 0.3644 | 0.13 | 0.83 | 0.3711 | 0.12 |
| Sleep on Old | -0.03 | 43.04 | -0.25 | 0.8032 | 0.04 | 0.06 | 0.8144 | 0.04 |
| Age on Control | -0.07 | 40.45 | -0.66 | 0.5146 | 0.12 | 0.43 | 0.5200 | 0.12 |
| Age on SR | -0.02 | 44.40 | -0.28 | 0.7831 | 0.04 | 0.08 | 0.7833 | 0.04 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.07 | 63.87 | -0.91 | 0.3644 | 0.12 | 0.83 | 0.3611 | 0.13 |
| Sleep on Old | -0.03 | 43.04 | -0.25 | 0.8032 | 0.04 | 0.06 | 0.8122 | 0.05 |
| Age on Control | -0.07 | 40.45 | -0.66 | 0.5146 | 0.13 | 0.43 | 0.5622 | 0.11 |
| Age on SR | -0.02 | 44.40 | -0.28 | 0.7831 | 0.05 | 0.08 | 0.7733 | 0.05 |
| YSR vs OC | 0.00 | 35.64 | 0.03 | 0.9732 | 0.05 | 0.00 | 0.9756 | 0.04 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.25 | 0.618 | 0.25 | 0.618 | 0.05 | 0.8190 | 0.5843 | 0.612 | 0.06 | ||
| Sleep | 0.12 | 0.734 | 0.12 | 0.734 | 0.20 | 0.6554 | 0.7529 | 0.745 | 0.03 | ||
| Age*Sleep | 0.02 | 0.895 | 0.02 | 0.850 | 0.00 | 0.9488 | 0.9583 | 0.883 | 0.04 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.02 | 63.84 | 0.15 | 0.8788 | 0.04 | 0.02 | 0.8800 | 0.03 |
| Sleep on Old | 0.04 | 37.10 | 0.32 | 0.7471 | 0.06 | 0.11 | 0.7200 | 0.05 |
| Age on Control | -0.05 | 45.61 | -0.40 | 0.6876 | 0.07 | 0.16 | 0.6678 | 0.09 |
| Age on SR | -0.03 | 52.80 | -0.30 | 0.7676 | 0.06 | 0.09 | 0.7611 | 0.04 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.02 | 63.84 | 0.15 | 0.8788 | 0.03 | 0.02 | 0.8678 | 0.03 |
| Sleep on Old | 0.04 | 37.10 | 0.32 | 0.7471 | 0.05 | 0.11 | 0.7456 | 0.06 |
| Age on Control | -0.05 | 45.61 | -0.40 | 0.6876 | 0.09 | 0.16 | 0.7267 | 0.09 |
| Age on SR | -0.03 | 52.80 | -0.30 | 0.7676 | 0.05 | 0.09 | 0.7711 | 0.06 |
| YSR vs OC | -0.07 | 42.53 | -0.55 | 0.5874 | 0.10 | 0.30 | 0.5767 | 0.08 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.53 | 0.470 | 0.53 | 0.470 | 0.39 | 0.5319 | 0.4658 | 0.475 | 0.08 | ||
| Sleep | 0.42 | 0.519 | 0.42 | 0.519 | 0.62 | 0.4330 | 0.5442 | 0.525 | 0.04 | ||
| Age*Sleep | 1.37 | 0.245 | 0.09 | 0.310 | 1.10 | 0.2948 | 0.2487 | 0.226 | 0.16 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.04 | 61.52 | -0.36 | 0.7193 | 0.06 | 0.13 | 0.7267 | 0.06 |
| Sleep on Old | 0.13 | 44.35 | 1.32 | 0.1942 | 0.21 | 1.74 | 0.1900 | 0.21 |
| Age on Control | -0.14 | 51.58 | -1.36 | 0.1792 | 0.23 | 1.85 | 0.1689 | 0.23 |
| Age on SR | 0.03 | 52.94 | 0.31 | 0.7579 | 0.05 | 0.10 | 0.7456 | 0.05 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.04 | 61.52 | -0.36 | 0.7193 | 0.06 | 0.13 | 0.7400 | 0.06 |
| Sleep on Old | 0.13 | 44.35 | 1.32 | 0.1942 | 0.21 | 1.74 | 0.1967 | 0.22 |
| Age on Control | -0.14 | 51.58 | -1.36 | 0.1792 | 0.22 | 1.85 | 0.1889 | 0.24 |
| Age on SR | 0.03 | 52.94 | 0.31 | 0.7579 | 0.07 | 0.10 | 0.7511 | 0.04 |
| YSR vs OC | -0.10 | 49.61 | -0.93 | 0.3549 | 0.15 | 0.87 | 0.3522 | 0.14 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 1.56 | 0.216 | 1.56 | 0.216 | 1.50 | 0.2225 | 0.1987 | 0.233 | 0.13 | ||
| Sleep | 0.36 | 0.552 | 0.36 | 0.552 | 0.70 | 0.4026 | 0.5860 | 0.544 | 0.04 | ||
| Age*Sleep | 1.10 | 0.296 | 0.09 | 0.330 | 0.94 | 0.3343 | 0.3489 | 0.281 | 0.16 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.03 | 61.43 | -0.33 | 0.7437 | 0.05 | 0.11 | 0.7778 | 0.05 |
| Sleep on Old | 0.11 | 41.58 | 1.14 | 0.2613 | 0.20 | 1.30 | 0.2900 | 0.19 |
| Age on Control | -0.15 | 45.95 | -1.58 | 0.1218 | 0.25 | 2.48 | 0.1078 | 0.25 |
| Age on SR | -0.01 | 52.94 | -0.14 | 0.8866 | 0.05 | 0.02 | 0.9122 | 0.05 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | -0.03 | 61.43 | -0.33 | 0.7437 | 0.05 | 0.11 | 0.7411 | 0.05 |
| Sleep on Old | 0.11 | 41.58 | 1.14 | 0.2613 | 0.19 | 1.30 | 0.2689 | 0.20 |
| Age on Control | -0.15 | 45.95 | -1.58 | 0.1218 | 0.24 | 2.48 | 0.1300 | 0.25 |
| Age on SR | -0.01 | 52.94 | -0.14 | 0.8866 | 0.04 | 0.02 | 0.9078 | 0.04 |
| YSR vs OC | -0.12 | 46.87 | -1.21 | 0.2333 | 0.21 | 1.46 | 0.2433 | 0.19 |
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.11 | 0.746 | 0.11 | 0.746 | 0.77 | 0.3814 | 0.7496 | 0.769 | 0.06 | ||
| Sleep | 0.10 | 0.759 | 0.10 | 0.759 | 0.12 | 0.7285 | 0.7546 | 0.742 | 0.03 | ||
| Age*Sleep | 0.03 | 0.856 | -0.04 | 0.680 | 0.17 | 0.6835 | 0.9316 | 0.854 | 0.08 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.03 | 61.21 | 0.38 | 0.7053 | 0.05 | 0.14 | 0.7211 | 0.06 |
| Sleep on Old | 0.01 | 43.45 | 0.08 | 0.9346 | 0.04 | 0.01 | 0.9500 | 0.04 |
| Age on Control | 0.03 | 50.16 | 0.40 | 0.6896 | 0.09 | 0.16 | 0.7156 | 0.09 |
| Age on SR | 0.01 | 48.24 | 0.09 | 0.9268 | 0.03 | 0.01 | 0.9178 | 0.03 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 0.03 | 61.21 | 0.38 | 0.7053 | 0.06 | 0.14 | 0.6833 | 0.06 |
| Sleep on Old | 0.01 | 43.45 | 0.08 | 0.9346 | 0.03 | 0.01 | 0.9333 | 0.04 |
| Age on Control | 0.03 | 50.16 | 0.40 | 0.6896 | 0.07 | 0.16 | 0.7078 | 0.08 |
| Age on SR | 0.01 | 48.24 | 0.09 | 0.9268 | 0.04 | 0.01 | 0.9256 | 0.03 |
| YSR vs OC | 0.00 | 49.26 | 0.01 | 0.9898 | 0.05 | 0.00 | 0.9967 | 0.05 |
# Command selection. Copy the rest of the lines of code from the chunk of the reference figure and in the same order.
# Fig S1B Cluster Quality L-ratio {Design 2x2x(5xS)}
# As Fig.S1B
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"ClusterQuality.csv"),Vars = c(1,5,6,12:16),vIntP =c(4:8),lvlCh = list("HAB"="LR_s1", "T1"="LR_s2","T2"="LR_s3","T3"="LR_s4","Test"="LR_s5"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Cluster Quality", "","L-Ratio"),ylmP =c(0,10),hLin = F,lvIp=5)
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 1000,nBMM2 = 1000,Prc = 2)
# Fig S1D Peak firing rate {Design 2x2x(5xS)}
# As Fig.S1B
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"Parameters.csv"),Vars = c(1,5,6,12:16),vIntP =c(4:8),lvlCh = list("HAB"="pfr_s1", "T1"="pfr_s2","T2"="pfr_s3","T3"="pfr_s4","Test"="pfr_s5"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Object Exploration", "","Peak FR (Hz)"),ylmP =c(0,10),hLin = F,lvIp=5)
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 1000,nBMM2 = 1000,Prc = 2)
# Fig S1E Out of field firing rate {Design 2x2x(5xS)}
# As Fig.S1B
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"Parameters.csv"),Vars = c(1,5,6,17:21),vIntP =c(4:8),lvlCh = list("HAB"="outF_s1", "T1"="outF_s2","T2"="outF_s3","T3"="outF_s4","Test"="outF_s5"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Object Exploration", "","Out of Field FR (Hz)"),ylmP =c(0,1.5),hLin = F,lvIp=5)
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 1000,nBMM2 = 1000,Prc = 2)
# Fig S1F Number of fields {Design 2x2x(5xS)}
# As Fig.S1B
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"Parameters.csv"),Vars = c(1,5,6,22:26),vIntP =c(4:8),lvlCh = list("HAB"="NOfF_s1", "T1"="NOfF_s2","T2"="NOfF_s3","T3"="NOfF_s4","Test"="NOfF_s5"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Object Exploration", "","Number of Fields"),ylmP =c(0,3),hLin = F,lvIp=5)
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 1000,nBMM2 = 1000,Prc = 2)
# Fig S1G Field size {Design 2x2x(5xS)}
# As Fig.S1B
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"Parameters.csv"),Vars = c(1,5,6,36:40),vIntP =c(4:8),lvlCh = list("HAB"="SmFields_s1", "T1"="SmFields_s2","T2"="SmFields_s3","T3"="SmFields_s4","Test"="SmFields_s5"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Object Exploration", "",bquote('Field Size (cm'~(cm^2))),ylmP =c(0,600),hLin = F,lvIp=5)
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 1000,nBMM2 = 1000,Prc = 2)
# Fig S1H Spatial information content {Design 2x2x(5xS)}
# As Fig.S1B
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"Parameters.csv"),Vars = c(1,5,6,27:31),vIntP =c(4:8),lvlCh = list("HAB"="InfoC_s1", "T1"="InfoC_s2","T2"="InfoC_s3","T3"="InfoC_s4","Test"="InfoC_s5"))
Grp<- Grph.3(DatP = ExtendDT,"OPR",LblsP =c("Object Exploration", "","Spatial Information (bits/s)"),ylmP =c(0,3),hLin = F,lvIp=5)
ResGen<-AOVMx2.5(A=2,B=2,C=5,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 1000,nBMM2 = 1000,Prc = 2)Supplemental Figure 2. Detection of remapping threshold. A-B) Scatter plots showing correlations between Hab/T1 and T1/T2 in young (A) and old (B) animals. C-D) Results of a machine learning algorithm, MATLAB kmeans, used to approximate the threshold to determine stability. The algorithm was instructed to group the data into 3 categories using correlation values from young (C) and old (D) mice. Means for each category are indicated by black squares. In both graphs the best approximation coincided with a threshold value of 0.35. Blue ellipse/dots contain correlation values displaying high stability between Hab/T1 and T1/T2, coinciding with our definition of context cells, green ellipse/dots contain correlation values displaying low stability between Hab/T1, but high stability between T1/T2, coinciding with our definition of object configuration cells, red ellipse/dots contain correlation values displaying low stability between Hab/T1 and T1/T2, coinciding with our definition of unstable cells. E) Histogram showing cell counts for all correlations between Hab and T1. Low stability cells are shown in red, whereas high stability cells are shown in blue. Note that the distributions are not normal, which justified the selection of robust statistics for all the analyses. The threshold of 0.35 was the best approximation to separate stable and unstable cells between habituation and T1. Data in scatter plots and histogram distributions, as well as the output of a machine learning algorithm converge to indicate that the threshold of 0.35 is the best value to categorize cell types. Hab: habituation, T1-3: Trials1-3.
Supplemental Figure 3. L-Ratio for animals included in the unmoved control experiment. There were no differences between young and old controls in cluster quality across trails [effect of age: Fw(1)-1.14, p=0.30, effect of trial: Fw(4)=1.86, p=0.15; interaction age vs. trial: Fw(4)=0.07, p=0.99]. YC: young control, OC: old control. Statistical details in Supplemental Statistical Table corresponding to Supplemental Figure 3.
NmBas="FigS3 UnMovedLRatio"
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
ResGen<-NA
rrt<-ExDataIS.3c(nmF = paste0(PathDesign,"ClusterQualityNonMovedControl.csv"),Vars = ,c(4,5,1,11:15),vIntP =c(4:8),lvlCh = list("HAB"="LR_s1", "T1"="LR_s2","T2"="LR_s3","T3"="LR_s4","Test"="LR_s5"))
DatDT<-rrt$DT
ArP<-rrt$Arp
ExtendDT<-rrt$ExtendDT
#Graphs
Grp<- Grph.3b(DatP = ExtendDT,"OPR",LblsP =c("Cluster Quality", "","L-Ratio"),ylmP =c(0,10),hLin = F,lvIp = 5,GrpSel = c(1,3))
Grp2=Grp
#AOV
names(rrt$DT)[3:7]<-c("T1","T2","T3","T4","T5")
ResGen<-AOVMx2b(A=2,C=5,DatPas = rrt,DatEfSp = DatEfS,nBMM1 = 10000,nBMM2 = 1000,Prc = 2)
AlmacenGen(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign,NmBasP = NmBas,Typ=1)
# Other Graphs
ExtendDTCol<-copy(ExtendDT)
ExtendDTCol$Moment<-"All"
ExtendDTCol<-data.table(rbind(ExtendDT,ExtendDTCol))
Grp3<- Grph.3b(DatP = ExtendDTCol,"OPR",LblsP =c("Cluster Quality", "","L-Ratio"),ylmP =c(0,10),hLin = F,lvIp = 6,GrpSel = c(1,3),wMain = T)
ExtendCpy<-copy(ExtendDT)
names(ExtendCpy)[1]<-"Age"
GrpO<-Grph.3.Otrosb(ExtendDTp = ExtendCpy,LblsP =c("Cluster Quality", "","L-Ratio"))
pdf(paste0(NmFAlL,NmBas,"OtrosGraphs.pdf"))
Grp3
GrpO
dev.off()
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResGen[[1]], "Omnibus AOV. Design 2x(5xS)");cat("\n")
Kbl3(ResGen[[2]], "Simple Effects Age-Time. Design 2x(5xS)")
Kbl3(ResGen[[3]], "Main Effects of Time. Design 2x(5xS)")[1] "Taking bootstrap samples. Please wait."
[1] "Taking bootstrap samples. Please wait."
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$BP
$Bars
$MargAC
$MargC
quartz_off_screen
2
$AOV
Names Q p pBoot Sig pBootMas Sig2 EffSize
1: Age 1.14 0.2945 0.3456 0.3018 0.19
2: Trial 1.86 0.1490 0.1619 0.1724 0.10
3: Age*Trial 0.07 0.9902 0.9900 0.9909 0.03
$InterAC
Contr psihat df test p.value EfSize.V1
1: Age on M1 -0.22 22.87 -0.72 0.4798 0.14
2: Age on M2 -0.18 22.71 -0.72 0.4800 0.15
3: Age on M3 -0.21 19.75 -0.89 0.3856 0.19
4: Age on M4 -0.24 25.29 -0.83 0.4119 0.16
5: Age on M5 -0.29 30.93 -1.48 0.1499 0.28
6: M1-M2 on Young 0.01 NA 0.06 0.9559 0.06
7: M1-M2 on Old 0.11 NA 0.77 0.4538 0.08
8: M2-M3 on Young 0.11 NA 1.12 0.2817 0.22
9: M2-M3 on Old 0.03 NA 0.20 0.8456 0.10
10: M3-M4 on Young -0.19 NA -1.48 0.1635 0.20
11: M3-M4 on Old -0.10 NA -1.46 0.1678 0.15
12: M4-M5 on Young 0.14 NA 0.58 0.5725 0.09
13: M4-M5 on Old 0.15 NA 0.77 0.4576 0.06
$DetallMainC
Contr psihat test p.value Psihat2 p.value2 EfSize.V1
1: M1-M2 0.08 0.50 0.6243 0.18 0.424 0.06
2: M2-M3 0.16 0.82 0.4260 0.32 0.116 0.16
3: M3-M4 -0.44 -2.94 0.0116 -0.42 0.004 0.17
4: M4-M5 0.26 0.57 0.5754 0.18 0.628 0.07
| Names | Q | p | pBoot | Sig | pBootMas | Sig2 | EffSize |
|---|---|---|---|---|---|---|---|
| Age | 1.14 | 0.2945 | 0.3456 | 0.3018 | 0.19 | ||
| Trial | 1.86 | 0.1490 | 0.1619 | 0.1724 | 0.10 | ||
| Age*Trial | 0.07 | 0.9902 | 0.9900 | 0.9909 | 0.03 |
| Contr | psihat | df | test | p.value | EfSize.V1 |
|---|---|---|---|---|---|
| Age on M1 | -0.22 | 22.87 | -0.72 | 0.4798 | 0.14 |
| Age on M2 | -0.18 | 22.71 | -0.72 | 0.4800 | 0.15 |
| Age on M3 | -0.21 | 19.75 | -0.89 | 0.3856 | 0.19 |
| Age on M4 | -0.24 | 25.29 | -0.83 | 0.4119 | 0.16 |
| Age on M5 | -0.29 | 30.93 | -1.48 | 0.1499 | 0.28 |
| M1-M2 on Young | 0.01 | NA | 0.06 | 0.9559 | 0.06 |
| M1-M2 on Old | 0.11 | NA | 0.77 | 0.4538 | 0.08 |
| M2-M3 on Young | 0.11 | NA | 1.12 | 0.2817 | 0.22 |
| M2-M3 on Old | 0.03 | NA | 0.20 | 0.8456 | 0.10 |
| M3-M4 on Young | -0.19 | NA | -1.48 | 0.1635 | 0.20 |
| M3-M4 on Old | -0.10 | NA | -1.46 | 0.1678 | 0.15 |
| M4-M5 on Young | 0.14 | NA | 0.58 | 0.5725 | 0.09 |
| M4-M5 on Old | 0.15 | NA | 0.77 | 0.4576 | 0.06 |
| Contr | psihat | test | p.value | Psihat2 | p.value2 | EfSize.V1 |
|---|---|---|---|---|---|---|
| M1-M2 | 0.08 | 0.50 | 0.6243 | 0.18 | 0.424 | 0.06 |
| M2-M3 | 0.16 | 0.82 | 0.4260 | 0.32 | 0.116 | 0.16 |
| M3-M4 | -0.44 | -2.94 | 0.0116 | -0.42 | 0.004 | 0.17 |
| M4-M5 | 0.26 | 0.57 | 0.5754 | 0.18 | 0.628 | 0.07 |
Supplemental Figure 4. Bayes classifier validation. A) Photograph of the SD chamber. B) Representative 5 hr sleep recording showing electroencephalogram (EEG, top panel) and electromyograph (EMG, bottom panel) color-coded using the output of a Bayes classifier. The color-coded EEG and EMG trace illustrates the accuracy of the classifier detecting Wake, NREM and REM periods. C-D) Average normalized confusion matrices for young (C) and old (D) mice. To determine the accuracy, sensitivity and specificity of the classifier, a confusion matrix was created by comparing visual and algorithm scored data in 4 young and 4 old mice. The results of this comparison were summed into the matrix for each animal. Each entry was then divided by the total number of epochs and multiplied by 100 to turn the values into percentages. Average confusion matrices were computed for young (C) and old (D) mice. E) Accuracy of the Bayes classifier for young and old mice. F) Receiver operating characteristic (ROC) curve showing average values of sensitivity (true positive rates) against false positive rates (1-specificity) for Wake, NREM, and REM in young and old mice. In the center of Figure F there is an enlargement of the execution data. The high accuracy of the classifier is illustrated by the fact that all values are plotted in the upper left area, indicating high sensitivity and low fallout errors.
NmBas="FigS4E_F BayesClassifier"
NmFich<-paste0(PathDesign,"SensAnalysisAll.csv");
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
ResROC<-list()
DatDTFull <- data.table(read.table(NmFich, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
DatDTFull$Label_P<-factor(DatDTFull$Label_P)
DatDTFull$Label_P<-relevel(DatDTFull$Label_P,"Wake")
DatDTFull$Label_T<-factor(DatDTFull$Label_T)
DatDTFull$Label_T<-relevel(DatDTFull$Label_T,"Wake")
DatDTFull$Group<-factor(DatDTFull$Group)
DatDTFull$Group<-relevel(DatDTFull$Group,"Young")
SelGrp<-DatDTFull[Group=="Old"&Subject!="TT"]
SelGrp$Subject<-factor(SelGrp$Subject)
out1<-lapply(1:4, function(i) {
SelSbj<-SelGrp[Subject==levels(SelGrp$Subject)[i]]
xtb<-xtabs(DepVar~Label_P+Label_T,data=SelSbj)
round(confusionMatrix(xtb, mode="everything")$overall[c(1,2,7)],4)
})
out2<-lapply(1:4, function(i) {
SelSbj<-SelGrp[Subject==levels(SelGrp$Subject)[i]]
xtb<-xtabs(DepVar~Label_P+Label_T,data=SelSbj)
round(confusionMatrix(xtb, mode="everything")$byClass,4)
})
Rest2<-data.frame("Group"="Old","Subject"=levels(SelGrp$Subject),do.call(rbind,out1))
ResIntr<-data.frame(matrix(do.call(rbind,out2),nrow=12,byrow=F))
names(ResIntr)<-labels(out2[[1]])[[2]]
Rest2.2<-data.frame("Group"="Old","Band"=rep(levels(SelGrp$Label_T),4),"Subject"=rep(levels(SelGrp$Subject),each=3),ResIntr)
SelGrp<-DatDTFull[Group=="Young"&Subject!="TT"]
SelGrp$Subject<-factor(SelGrp$Subject)
out1<-lapply(1:4, function(i) {
SelSbj<-SelGrp[Subject==levels(SelGrp$Subject)[i]]
xtb<-xtabs(DepVar~Label_P+Label_T,data=SelSbj)
round(confusionMatrix(xtb, mode="everything")$overall[c(1,2,7)],4)
})
out2<-lapply(1:4, function(i) {
SelSbj<-SelGrp[Subject==levels(SelGrp$Subject)[i]]
xtb<-xtabs(DepVar~Label_P+Label_T,data=SelSbj)
round(confusionMatrix(xtb, mode="everything")$byClass,4)
})
Rest2b<-data.frame("Group"="Young","Subject"=levels(SelGrp$Subject),do.call(rbind,out1))
ResIntr<-data.frame(matrix(do.call(rbind,out2),nrow=12,byrow=F))
names(ResIntr)<-labels(out2[[1]])[[2]]
Rest2.2b<-data.frame("Group"="Young","Band"=rep(levels(SelGrp$Label_T),4),"Subject"=rep(levels(SelGrp$Subject),each=3),ResIntr)
Rest2f<- rbind(Rest2b,Rest2)
Rest2f.2<- rbind(Rest2.2b,Rest2.2)
Rest2f$Group<-factor(Rest2f$Group); Rest2f$Group<-relevel(Rest2f$Grou,"Young")
Rest2f.2$Group<-factor(Rest2f.2$Group); Rest2f.2$Group<-relevel(Rest2f.2$Group,"Young")
Rest2f.2$Band<- factor(Rest2f.2$Band); Rest2f.2$Band<- relevel(Rest2f.2$Band,"Wake")
write.csv2(Rest2f,paste0(NmFAlL,NmBas,"ResultSensib1_Acc.csv"))
write.csv2(Rest2f.2,paste0(NmFAlL,NmBas,"ResultSensib2_ROC.csv"))
# Accuracy Graph
Grp2<-ggplot(Rest2f, aes(x = factor(Group), y = Accuracy)) +
geom_boxplot(position=position_dodge(0.8),lwd=1)+
geom_dotplot(binaxis='y', stackdir='center',
binpositions="all",dotsize = 1.5) +
stat_summary(fun.y=mean, geom="point", shape=18,
size=10, color="red") + theme_classic2() +ylim(0.85,1) + labs(x="") +
theme(legend.position="None", text = element_text(size=28),
axis.title.x = element_text(color = "black",family="ArialMT",size=28,face="bold"),
axis.title.y = element_text(color = "black",family="ArialMT",size=28,face="bold"),
axis.text.x = element_text(color = "black",family="ArialMT",size=20,face="bold"),
axis.text.y = element_text(color = "black",family="ArialMT",size=20,face="bold")) +
labs(x="")
pdf(paste0(NmFAlL,NmBas,"_Accuracy.pdf"),family = "ArialMT")
plot(Grp2)
dev.off()
# ROC with all data points
g2<-ggplot(Rest2f.2, aes(x = 1-Specificity, y = Sensitivity,colour=Band,shape=Group))
Grp3<-g2+ geom_point(size=4) + xlim(0,1) + ylim(0,1) + geom_abline(intercept = 0,lty=3) +
theme_linedraw() + theme(legend.position="bottom", text = element_text(size=28),legend.title=element_text(size=12),
legend.text=element_text(size=12))
pdf(paste0(NmFAlL,NmBas,"_SensSpec.pdf"),family = "ArialMT")
plot(Grp3)
dev.off()
# ROC with means
SelGrp<-DatDTFull[Subject=="TT"]
SelGrp$Subject<-factor(SelGrp$Subject)
SelGrp$Group<-factor(SelGrp$Group)
out1<-lapply(1:2, function(i) {
SelSbj<-SelGrp[Group==levels(SelGrp$Group)[i]]
xtb<-xtabs(DepVar~Label_P+Label_T,data=SelSbj)
round(confusionMatrix(xtb, mode="everything")$byClass,4)
})
Restc<-matrix(do.call(rbind,out1),nrow=6,byrow=F)
Rest2c<-data.frame(cbind(rep(levels(SelGrp$Label_T),2),rep(levels(SelGrp$Group),each=3)),Restc)
names(Rest2c)<-c("Band","Group",labels(out1[[1]])[[2]])
Rest2c$Band<-factor(Rest2c$Band)
Rest2c$Band<-relevel(Rest2c$Band,"Wake")
Rest2c$Group<-factor(Rest2c$Group)
Rest2c$Group<-relevel(Rest2c$Group,"Young")
write.csv2(Rest2c,paste0(NmFAlL,NmBas,"ResultSensib3_ROCMeans.csv"))
DTRes<-data.table(Rest2f.2)
df2<-DTRes[,.(DepVar=Mean_MM(Sensitivity),sem=SEM_MM(Sensitivity)),by=c("Group", "Band")]
df3<-DTRes[,.(DepVar=Mean_MM(1-Specificity),sem=SEM_MM(1-Specificity)),by=c("Group", "Band")]
ColorEj<-rep(c("brown4","darkgreen","blue4"),2)
g2<-ggplot(Rest2c, aes(x = 1-Specificity, y = Sensitivity,colour=Band,shape=Group))
Grp4<-g2+ geom_point(size=3.5) + xlim(0,1) + ylim(0,1) + geom_abline(intercept = 0,lty=3) +
theme_linedraw() +
theme(legend.position="bottom", text = element_text(size=20),legend.title=element_text(size=12),
legend.text=element_text(size=12),axis.line = element_line(colour = "black",
size = 1, linetype = "solid"),
panel.grid = element_line(color = "gray46"),
plot.margin=unit(c(1.2,1.2,1.2,1.2),"cm"),
axis.title.x = element_text(color = "black",family="ArialMT",size=28,face="bold"),
axis.title.y = element_text(color = "black",family="ArialMT",size=28,face="bold"),
axis.text.x = element_text(color = "black",family="ArialMT",size=20,face="bold"),
axis.text.y = element_text(color = "black",family="ArialMT",size=20,face="bold")) +
geom_errorbarh(aes(xmin=1-Rest2c$Specificity-df3$sem, xmax=1-Rest2c$Specificity+df3$sem),
size=0.2,color=ColorEj) +
geom_errorbar(aes(ymin=Rest2c$Sensitivity-df2$sem, ymax=Rest2c$Sensitivity+df2$sem),
size=0.2,color=ColorEj) +
geom_hline(yintercept=1, size = 1, linetype = "solid") +
geom_vline(xintercept=1, size = 1, linetype = "solid") +
scale_x_continuous(expand = c(0, 0), limits = c(0, NA)) +
scale_y_continuous(expand = c(0, 0), limits = c(0, NA))
pdf(paste0(NmFAlL,NmBas,"_AllSens.pdf"),family = "ArialMT")
plot(Grp4)
dev.off()
# Results
ResROC$Acc<-Rest2f
ResROC$ROCAll<-Rest2f.2
ResROC$ROCMeans<-Rest2c
ResROC$Acc
ResROC$ROCAll
ResROC$ROCMeans
Kbl3(ResPas = ResROC[[1]], lbl = "Accuracy Analysis")
Kbl3(ResPas = ResROC[[2]], lbl = "ROC Analysis All Data")
Kbl3(ResPas = ResROC[[3]], lbl = "ROC Analysis Means")
# Accuracy Graph
plot(Grp2)
# ROC with all data points
plot(Grp3)
# ROC with means
plot(Grp4)quartz_off_screen
2
quartz_off_screen
2
quartz_off_screen
2
Group Subject Accuracy Kappa McnemarPValue
1 Young AT_10_Y_C_P 0.9049 0.8160 0.9984
2 Young AT_15_Y_C_R 0.9331 0.8702 0.9998
3 Young AT_18_Y_D_R 0.9360 0.8859 0.9997
4 Young MT_7_Y_D_R 0.9051 0.8283 0.9935
5 Old AEG_2_O_D_R 0.9327 0.8896 0.9963
6 Old AT_12_O_D_R 0.9187 0.8324 0.9994
7 Old AT_21_O_C_R 0.8945 0.7986 0.9933
8 Old MT_0_O_D_R 0.8707 0.7633 0.9998
Group Band Subject Sensitivity Specificity Pos.Pred.Value Neg.Pred.Value
1 Young Wake AT_10_Y_C_P 0.7623 0.9789 0.9316 0.9161
2 Young NREM AT_10_Y_C_P 0.9646 0.8690 0.9252 0.9359
3 Young REM AT_10_Y_C_P 0.9215 0.9657 0.7473 0.9911
4 Young Wake AT_15_Y_C_R 0.9220 0.9814 0.9627 0.9604
5 Young NREM AT_15_Y_C_R 0.9567 0.9190 0.9477 0.9326
6 Young REM AT_15_Y_C_R 0.7364 0.9761 0.6331 0.9851
7 Young Wake AT_18_Y_D_R 0.9681 0.9559 0.9118 0.9845
8 Young NREM AT_18_Y_D_R 0.9509 0.9592 0.9687 0.9364
9 Young REM AT_18_Y_D_R 0.7647 0.9815 0.8359 0.9714
10 Young Wake MT_7_Y_D_R 0.8556 0.9990 0.9975 0.9372
11 Young NREM MT_7_Y_D_R 0.9226 0.9654 0.9764 0.8892
12 Young REM MT_7_Y_D_R 0.9732 0.9128 0.4739 0.9976
13 Old Wake AEG_2_O_D_R 0.8389 0.9953 0.9913 0.9061
14 Old NREM AEG_2_O_D_R 0.9946 0.9956 0.9955 0.9948
15 Old REM AEG_2_O_D_R 0.9852 0.9293 0.6548 0.9978
16 Old Wake AT_12_O_D_R 0.8506 0.9728 0.8999 0.9578
17 Old NREM AT_12_O_D_R 0.9522 0.9184 0.9610 0.9009
18 Old REM AT_12_O_D_R 0.8416 0.9623 0.7086 0.9824
19 Old Wake AT_21_O_C_R 0.8015 0.9941 0.9871 0.8993
20 Old NREM AT_21_O_C_R 0.9448 0.8483 0.9002 0.9139
21 Old REM AT_21_O_C_R 0.9685 0.9582 0.5457 0.9983
22 Old Wake MT_0_O_D_R 0.7956 0.9179 0.7950 0.9182
23 Old NREM MT_0_O_D_R 0.9232 0.9236 0.9492 0.8860
24 Old REM MT_0_O_D_R 0.7729 0.9545 0.6697 0.9724
Precision Recall F1 Prevalence Detection.Rate Detection.Prevalence
1 0.9316 0.7623 0.8385 0.2739 0.2088 0.2241
2 0.9252 0.9646 0.9445 0.6270 0.6048 0.6537
3 0.7473 0.9215 0.8253 0.0991 0.0913 0.1222
4 0.9627 0.9220 0.9419 0.3416 0.3150 0.3272
5 0.9477 0.9567 0.9522 0.6053 0.5791 0.6111
6 0.6331 0.7364 0.6808 0.0531 0.0391 0.0617
7 0.9118 0.9681 0.9391 0.3201 0.3099 0.3399
8 0.9687 0.9509 0.9597 0.5704 0.5424 0.5599
9 0.8359 0.7647 0.7987 0.1095 0.0837 0.1002
10 0.9975 0.8556 0.9211 0.3169 0.2711 0.2718
11 0.9764 0.9226 0.9487 0.6085 0.5614 0.5749
12 0.4739 0.9732 0.6374 0.0746 0.0726 0.1533
13 0.9913 0.8389 0.9087 0.3902 0.3273 0.3302
14 0.9955 0.9946 0.9950 0.4901 0.4874 0.4896
15 0.6548 0.9852 0.7867 0.1198 0.1180 0.1802
16 0.8999 0.8506 0.8745 0.2230 0.1897 0.2108
17 0.9610 0.9522 0.9566 0.6788 0.6463 0.6725
18 0.7086 0.8416 0.7694 0.0982 0.0827 0.1166
19 0.9871 0.8015 0.8847 0.3592 0.2879 0.2917
20 0.9002 0.9448 0.9220 0.5915 0.5589 0.6208
21 0.5457 0.9685 0.6981 0.0493 0.0478 0.0875
22 0.7950 0.7956 0.7953 0.2859 0.2275 0.2861
23 0.9492 0.9232 0.9360 0.6074 0.5608 0.5908
24 0.6697 0.7729 0.7176 0.1066 0.0824 0.1231
Balanced.Accuracy
1 0.8706
2 0.9168
3 0.9436
4 0.9517
5 0.9378
6 0.8562
7 0.9620
8 0.9550
9 0.8731
10 0.9273
11 0.9440
12 0.9430
13 0.9171
14 0.9951
15 0.9572
16 0.9117
17 0.9353
18 0.9020
19 0.8978
20 0.8966
21 0.9633
22 0.8568
23 0.9234
24 0.8637
Band Group Sensitivity Specificity Pos Pred Value Neg Pred Value Precision
1 Wake Young 0.8820 0.9788 0.9500 0.9479 0.9500
2 NREM Young 0.9488 0.9295 0.9533 0.9228 0.9533
3 REM Young 0.8527 0.9589 0.6556 0.9861 0.6556
4 Wake Old 0.8205 0.9685 0.9227 0.9216 0.9227
5 NREM Old 0.9517 0.9262 0.9493 0.9296 0.9493
6 REM Old 0.8847 0.9513 0.6519 0.9877 0.6519
Recall F1 Prevalence Detection Rate Detection Prevalence
1 0.8820 0.9147 0.3131 0.2762 0.2907
2 0.9488 0.9510 0.6028 0.5719 0.5999
3 0.8527 0.7413 0.0841 0.0717 0.1094
4 0.8205 0.8686 0.3146 0.2581 0.2797
5 0.9517 0.9505 0.5919 0.5633 0.5934
6 0.8847 0.7507 0.0935 0.0827 0.1269
Balanced Accuracy
1 0.9304
2 0.9392
3 0.9058
4 0.8945
5 0.9390
6 0.9180
| Group | Subject | Accuracy | Kappa | McnemarPValue |
|---|---|---|---|---|
| Young | AT_10_Y_C_P | 0.9049 | 0.8160 | 0.9984 |
| Young | AT_15_Y_C_R | 0.9331 | 0.8702 | 0.9998 |
| Young | AT_18_Y_D_R | 0.9360 | 0.8859 | 0.9997 |
| Young | MT_7_Y_D_R | 0.9051 | 0.8283 | 0.9935 |
| Old | AEG_2_O_D_R | 0.9327 | 0.8896 | 0.9963 |
| Old | AT_12_O_D_R | 0.9187 | 0.8324 | 0.9994 |
| Old | AT_21_O_C_R | 0.8945 | 0.7986 | 0.9933 |
| Old | MT_0_O_D_R | 0.8707 | 0.7633 | 0.9998 |
| Group | Band | Subject | Sensitivity | Specificity | Pos.Pred.Value | Neg.Pred.Value | Precision | Recall | F1 | Prevalence | Detection.Rate | Detection.Prevalence | Balanced.Accuracy |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Young | Wake | AT_10_Y_C_P | 0.7623 | 0.9789 | 0.9316 | 0.9161 | 0.9316 | 0.7623 | 0.8385 | 0.2739 | 0.2088 | 0.2241 | 0.8706 |
| Young | NREM | AT_10_Y_C_P | 0.9646 | 0.8690 | 0.9252 | 0.9359 | 0.9252 | 0.9646 | 0.9445 | 0.6270 | 0.6048 | 0.6537 | 0.9168 |
| Young | REM | AT_10_Y_C_P | 0.9215 | 0.9657 | 0.7473 | 0.9911 | 0.7473 | 0.9215 | 0.8253 | 0.0991 | 0.0913 | 0.1222 | 0.9436 |
| Young | Wake | AT_15_Y_C_R | 0.9220 | 0.9814 | 0.9627 | 0.9604 | 0.9627 | 0.9220 | 0.9419 | 0.3416 | 0.3150 | 0.3272 | 0.9517 |
| Young | NREM | AT_15_Y_C_R | 0.9567 | 0.9190 | 0.9477 | 0.9326 | 0.9477 | 0.9567 | 0.9522 | 0.6053 | 0.5791 | 0.6111 | 0.9378 |
| Young | REM | AT_15_Y_C_R | 0.7364 | 0.9761 | 0.6331 | 0.9851 | 0.6331 | 0.7364 | 0.6808 | 0.0531 | 0.0391 | 0.0617 | 0.8562 |
| Young | Wake | AT_18_Y_D_R | 0.9681 | 0.9559 | 0.9118 | 0.9845 | 0.9118 | 0.9681 | 0.9391 | 0.3201 | 0.3099 | 0.3399 | 0.9620 |
| Young | NREM | AT_18_Y_D_R | 0.9509 | 0.9592 | 0.9687 | 0.9364 | 0.9687 | 0.9509 | 0.9597 | 0.5704 | 0.5424 | 0.5599 | 0.9550 |
| Young | REM | AT_18_Y_D_R | 0.7647 | 0.9815 | 0.8359 | 0.9714 | 0.8359 | 0.7647 | 0.7987 | 0.1095 | 0.0837 | 0.1002 | 0.8731 |
| Young | Wake | MT_7_Y_D_R | 0.8556 | 0.9990 | 0.9975 | 0.9372 | 0.9975 | 0.8556 | 0.9211 | 0.3169 | 0.2711 | 0.2718 | 0.9273 |
| Young | NREM | MT_7_Y_D_R | 0.9226 | 0.9654 | 0.9764 | 0.8892 | 0.9764 | 0.9226 | 0.9487 | 0.6085 | 0.5614 | 0.5749 | 0.9440 |
| Young | REM | MT_7_Y_D_R | 0.9732 | 0.9128 | 0.4739 | 0.9976 | 0.4739 | 0.9732 | 0.6374 | 0.0746 | 0.0726 | 0.1533 | 0.9430 |
| Old | Wake | AEG_2_O_D_R | 0.8389 | 0.9953 | 0.9913 | 0.9061 | 0.9913 | 0.8389 | 0.9087 | 0.3902 | 0.3273 | 0.3302 | 0.9171 |
| Old | NREM | AEG_2_O_D_R | 0.9946 | 0.9956 | 0.9955 | 0.9948 | 0.9955 | 0.9946 | 0.9950 | 0.4901 | 0.4874 | 0.4896 | 0.9951 |
| Old | REM | AEG_2_O_D_R | 0.9852 | 0.9293 | 0.6548 | 0.9978 | 0.6548 | 0.9852 | 0.7867 | 0.1198 | 0.1180 | 0.1802 | 0.9572 |
| Old | Wake | AT_12_O_D_R | 0.8506 | 0.9728 | 0.8999 | 0.9578 | 0.8999 | 0.8506 | 0.8745 | 0.2230 | 0.1897 | 0.2108 | 0.9117 |
| Old | NREM | AT_12_O_D_R | 0.9522 | 0.9184 | 0.9610 | 0.9009 | 0.9610 | 0.9522 | 0.9566 | 0.6788 | 0.6463 | 0.6725 | 0.9353 |
| Old | REM | AT_12_O_D_R | 0.8416 | 0.9623 | 0.7086 | 0.9824 | 0.7086 | 0.8416 | 0.7694 | 0.0982 | 0.0827 | 0.1166 | 0.9020 |
| Old | Wake | AT_21_O_C_R | 0.8015 | 0.9941 | 0.9871 | 0.8993 | 0.9871 | 0.8015 | 0.8847 | 0.3592 | 0.2879 | 0.2917 | 0.8978 |
| Old | NREM | AT_21_O_C_R | 0.9448 | 0.8483 | 0.9002 | 0.9139 | 0.9002 | 0.9448 | 0.9220 | 0.5915 | 0.5589 | 0.6208 | 0.8966 |
| Old | REM | AT_21_O_C_R | 0.9685 | 0.9582 | 0.5457 | 0.9983 | 0.5457 | 0.9685 | 0.6981 | 0.0493 | 0.0478 | 0.0875 | 0.9633 |
| Old | Wake | MT_0_O_D_R | 0.7956 | 0.9179 | 0.7950 | 0.9182 | 0.7950 | 0.7956 | 0.7953 | 0.2859 | 0.2275 | 0.2861 | 0.8568 |
| Old | NREM | MT_0_O_D_R | 0.9232 | 0.9236 | 0.9492 | 0.8860 | 0.9492 | 0.9232 | 0.9360 | 0.6074 | 0.5608 | 0.5908 | 0.9234 |
| Old | REM | MT_0_O_D_R | 0.7729 | 0.9545 | 0.6697 | 0.9724 | 0.6697 | 0.7729 | 0.7176 | 0.1066 | 0.0824 | 0.1231 | 0.8637 |
| Band | Group | Sensitivity | Specificity | Pos Pred Value | Neg Pred Value | Precision | Recall | F1 | Prevalence | Detection Rate | Detection Prevalence | Balanced Accuracy |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Wake | Young | 0.8820 | 0.9788 | 0.9500 | 0.9479 | 0.9500 | 0.8820 | 0.9147 | 0.3131 | 0.2762 | 0.2907 | 0.9304 |
| NREM | Young | 0.9488 | 0.9295 | 0.9533 | 0.9228 | 0.9533 | 0.9488 | 0.9510 | 0.6028 | 0.5719 | 0.5999 | 0.9392 |
| REM | Young | 0.8527 | 0.9589 | 0.6556 | 0.9861 | 0.6556 | 0.8527 | 0.7413 | 0.0841 | 0.0717 | 0.1094 | 0.9058 |
| Wake | Old | 0.8205 | 0.9685 | 0.9227 | 0.9216 | 0.9227 | 0.8205 | 0.8686 | 0.3146 | 0.2581 | 0.2797 | 0.8945 |
| NREM | Old | 0.9517 | 0.9262 | 0.9493 | 0.9296 | 0.9493 | 0.9517 | 0.9505 | 0.5919 | 0.5633 | 0.5934 | 0.9390 |
| REM | Old | 0.8847 | 0.9513 | 0.6519 | 0.9877 | 0.6519 | 0.8847 | 0.7507 | 0.0935 | 0.0827 | 0.1269 | 0.9180 |
Supplemental Figure 5. Power spectra during NREM and REM during post-learning and recovery and relative sigma (RSP) and beta (RBP) power. A-F) NREM and REM average (red) and individual (gray) power spectra during post-learning (A-B) and recovery (C-F) for all groups. G-J) Relative sigma (RSP) and beta (RBP) did not show differences during post-learning (G-H) or recovery (I-J). Sigma: 10-15 Hz, beta: 15-25 Hz. YC: young control, YSD: young sleep deprived, OC: old control, OSD: old sleep deprived. Statistical details in Supplemental Statistical Table corresponding to Supplemental Figure 4.
NmBas="FigS5G_H Band Power PostL"
NmFich="BandPowerPostL.csv";
NmFich<-paste0(PathDesign,NmFich);
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
DatDTFull <- data.table(read.table(NmFich, header=TRUE, sep=";", na.strings="NA", dec=",",strip.white=TRUE))
DatDT<-DatDTFull
DatDT$Group<-factor(DatDT$Group);DatDT$Group<-relevel(DatDT$Group,"Young_C")
ResFn<-ResAOV1<-list()
i=1
for (i in 1:5) {
DepVar<-names(DatDTFull)[8+i]
YuenRes<-WRS2::yuen(get(DepVar)~Group,DatDT)
ResFnPrv<-data.table(with(YuenRes,
cbind(DepV=DepVar,diff=round(diff,2),df=round(df,2),test=round(test,2),
EffSize=round(effsize,2),p=round(p.value,4))))
ResFn<-rbind(ResFn,ResFnPrv)
lvs<-c(4,7,8+i)
DatDTG<-DatDTFull[,..lvs];
DatDTG$Age<-factor(DatDTG$Age)
DatDTG$Age<-relevel(DatDTG$Age,"Young")
setkey(DatDTG,Age)
ArPGlobal<-c(lapply(1:2, function (x) DatDTG[.(levels(DatDTG$Age)[x]),3,with=F][[1]]),recursive = F)
ResAOV1[[i]]<-AOVSingle(ArPGlobal,2)
}
rbResRb22<-data.table(Vars=names(DatDTFull)[9:13],do.call(rbind, lapply(ResAOV1, as.data.table)))
GrpF<-list()
DepVar1<-names(DatDTFull)[8+1]
GrpF$A<- Grph.1(DatDT,DepVar1,LblsP =c("Preference for Displaced Object", "","Relative Delta Power"),c(0,50),F,GrpSel=c(1,3))
DepVar2<-names(DatDTFull)[8+2]
GrpF$B<- Grph.1(DatDT,DepVar2,LblsP =c("Preference for Displaced Object", "","Relative Sigma Power"),c(0,50),F,GrpSel=c(1,3))
DepVar3<-names(DatDTFull)[8+3]
GrpF$C<- Grph.1(DatDT,DepVar3,LblsP =c("Preference for Displaced Object", "","Relative Theta Power"),c(0,100),F,GrpSel=c(1,3))
DepVar4<-names(DatDTFull)[8+4]
GrpF$D<- Grph.1(DatDT,DepVar4,LblsP =c("Preference for Displaced Object", "","Relative Beta Power"),c(0,50),F,GrpSel=c(1,3))
DepVar5<-names(DatDTFull)[8+5]
GrpF$E<- Grph.1(DatDT,DepVar5,LblsP =c("Preference for Displaced Object", "",DepVar5),c(300,320),F,GrpSel=c(1,3))
ResRes<-list()
#ResRes[[1]]<-ResFn
ResRes[[1]]<-rbResRb22
AlmacenGen3(GrpP = GrpF,DataPas = ResRes,PathDesignP = PathDesign,NmBasP = NmBas, Typ=1)
NmBas2="FigS4G RelSigmaPower PostL"
pdf(paste0(NmFAlL,NmBas2,".pdf"))
GrpF$B
dev.off()
NmBas3="FigS4H RelBetaaPower PostL"
pdf(paste0(NmFAlL,NmBas3,".pdf"))
GrpF$D
dev.off()
pdf(paste0(NmFAlL,NmBas,"TodosGraphs.pdf"))
GrpF
dev.off()
# All
rrt<-ExDataIS.3c(nmF = paste0(PathDesign,"BandPowerPostL.csv"),Vars = c(4,5,7,9:12),vIntP =c(4:7),lvlCh = list("Delta"="delta_NREM", "Sigma"="sigma_NREM","Theta"="theta_REM","Beta"="beta_REM"))
GrpF2<-list()
GrpF2<-Grph.3b(rrt$ExtendDT,"Moment",LblsP =c("Preference for Unmoved Objects", "","Relative Power"),c(0,100),GrpSel = c(1,3),F)
pdf(paste0(NmFAlL,NmBas,"TodosGraphs.pdf"))
GrpF2
dev.off()
#Results
print("FigS4G RelSigmaPower PostL")
plot(GrpF$B)
print("FigS4H RelBetaaPower PostL")
plot(GrpF$D)
ResRes
Kbl3(ResRes, "Omnibus AOV. Design 2")quartz_off_screen
2
quartz_off_screen
2
$A
$B
$C
$D
$E
quartz_off_screen
2
quartz_off_screen
2
[1] "FigS4G RelSigmaPower PostL"
[1] "FigS4H RelBetaaPower PostL"
[[1]]
Vars t
1: delta_NREM Diff = -4.17, V(9.63) = 0.87, Eff.Size = 0.26, p = 0.4057
2: sigma_NREM Diff = 2.77, V(8.18) = 1.77, Eff.Size = 0.64, p = 0.1147
3: theta_REM Diff = 7.97, V(5.59) = 1.02, Eff.Size = 0.49, p = 0.3495
4: beta_REM Diff = 1.27, V(8.71) = 0.9, Eff.Size = 0.27, p = 0.3939
5: totalPercent Diff = 1.24, V(10.98) = 1.89, Eff.Size = 0.54, p = 0.0852
tRk1 t.2.Diff
1: Diff = -4.17, Fw(1,13.46) = 0.56, Eff.Size = 0.26, p = 0.4665 -4.17
2: Diff = 2.77, Fw(1,14.49) = 1.35, Eff.Size = 0.64, p = 0.2635 2.77
3: Diff = 7.97, Fw(1,12.89) = 0.56, Eff.Size = 0.49, p = 0.469 7.97
4: Diff = 1.27, Fw(1,11.05) = 1.06, Eff.Size = 0.27, p = 0.3247 1.27
5: Diff = 1.24, Fw(1,14.3) = 2.34, Eff.Size = 0.54, p = 0.1476 1.24
t.2.DF t.2.FW t.2.Ef.Size t.2.p tRk2.Diff tRk2.DF1 tRk2.DF2 tRk2.Fw
1: 9.63 0.87 0.26 0.4057 -4.17 1 13.46 0.56
2: 8.18 1.77 0.64 0.1147 2.77 1 14.49 1.35
3: 5.59 1.02 0.49 0.3495 7.97 1 12.89 0.56
4: 8.71 0.90 0.27 0.3939 1.27 1 11.05 1.06
5: 10.98 1.89 0.54 0.0852 1.24 1 14.30 2.34
tRk2.Ef.Size tRk2.p
1: 0.26 0.4665
2: 0.64 0.2635
3: 0.49 0.4690
4: 0.27 0.3247
5: 0.54 0.1476
|
NmBas="FigS5I RelSigmaPowerNREM Recover"
rrt<-ExData.2(nmF = paste0(PathDesign,"BandPowerRecover.csv"),Vars = c(4:5,10))
DatDT<-rrt$DT
ArP<-rrt$Arp
#Graphs
Grp<- Grph.2(DatDT,"sigma_NREM",LblsP =c("Preference for Unmoved Objects", "","Relative Sigma Power"),c(0,30),F)
Grp2<- Grp
# AOV & Simple Effects
ResGen<-NA
names(rrt$DT)[3]<-"DepV"
ResGen<-AOVBwF(2,2,DatPas = rrt,nBMM = 10000)
AlmacenGen(GrpP = Grp,Grp2P = Grp2,DataPas = ResGen,PathDesignP = PathDesign,NmBasP = NmBas,Typ=1)
#Results FigS4I RelSigmaPowerNREM Recover
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResGen[[1]], "Omnibus AOV. Design 2x2");cat("\n")
Kbl3(ResGen[[2]], "Simple Effects Age-Sleep. Design 2x2")
Kbl3(ResGen[[3]], "Extense Simple Effects Age-Sleep. Design 2x2")
NmBas="FigS5J RelBetaPowerREM Recover"
rrt<-ExData.2(nmF = paste0(PathDesign,"BandPowerRecover.csv"),Vars = c(4:5,11))
DatDT<-rrt$DT
ArP<-rrt$Arp
#Graphs
Grp<- Grph.2(DatDT,"theta_REM",LblsP =c("Preference for Unmoved Objects", "","Relative Theta Power"),c(0,100),F)
Grp2=Grp
# AOV & Simple Effects
ResGen<-NA
names(rrt$DT)[3]<-"DepV"
ResGen<-AOVBwF(2,2,DatPas = rrt,nBMM = 10000)
AlmacenGen(Grp,Grp2,ResGen,PathDesign,NmBas,Typ=1)
#Results FigS4J RelBetaPowerREM Recove
# Results
plot(Grp)
plot(Grp2) # Only this graph is printed in the html file.
ResGen # Lean option to view the results of statistical analysis
Kbl3(ResGen[[1]], "Omnibus AOV. Design 2x2");cat("\n")
Kbl3(ResGen[[2]], "Simple Effects Age-Sleep. Design 2x2")
Kbl3(ResGen[[3]], "Extense Simple Effects Age-Sleep. Design 2x2")
# All
rrt<-ExDataIS.2(nmF = paste0(PathDesign,"BandPowerRecover.csv"),Vars = c(4,5,7,9:12),vIntP =c(4:7),
lvlCh = list("Delta"="delta_NREM", "Sigma"="sigma_NREM","Theta"="theta_REM","Beta"="beta_REM"))
GrpF<-Grph.3(rrt$ExtendDT,"Moment",LblsP =c("Preference for Unmoved Objects", "","Relative Power"),c(0,100),F)
NmBas="FigBP_Band Power Recover All Bands"
NmFAlL<-paste0(PathDesign,NmBas)
if (!dir.exists(NmFAlL)) {dir.create(NmFAlL)}
NmFAlL<-paste0(NmFAlL,"/")
pdf(paste0(NmFAlL,NmBas,"TodosGraphs.pdf"))
GrpF
dev.off()[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.5142
2: B.p.value 0.3122
3: AB.p.value 0.8932
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.4989
2: B.p.value 0.3166
3: AB.p.value 0.8570
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.52 0.484 0.52 0.484 1.01 0.3226 0.5142 0.4989
2: Sleep 1.06 0.320 1.06 0.320 1.33 0.2584 0.3122 0.3166
3: Age*Sleep 0.04 0.848 0.01 0.970 0.02 0.8844 0.8932 0.8570
EffSize
1: 0.24
2: 0.31
3: 0.06
$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 1.19 11.93 0.81 0.4332 0.30 0.66 0.4456
2: Sleep on Old 1.74 7.90 0.72 0.4950 0.30 0.51 0.4794
3: Age on Control 0.74 7.45 0.31 0.7638 0.13 0.10 0.7900
4: Age on SR 1.30 11.68 0.84 0.4160 0.19 0.71 0.4256
EffSize.Boot
1: 0.30
2: 0.30
3: 0.12
4: 0.18
$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 1.19 11.93 0.81 0.4332 0.30 0.66 0.4111
2: Sleep on Old 1.74 7.90 0.72 0.4950 0.30 0.51 0.5011
3: Age on Control 0.74 7.45 0.31 0.7638 0.14 0.10 0.7709
4: Age on SR 1.30 11.68 0.84 0.4160 0.17 0.71 0.4311
5: YSR vs OC -0.44 7.13 -0.19 0.8560 0.11 0.04 0.8744
EffSize.Boot
1: 0.30
2: 0.27
3: 0.14
4: 0.19
5: 0.12
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.52 | 0.484 | 0.52 | 0.484 | 1.01 | 0.3226 | 0.5142 | 0.4989 | 0.24 | ||
| Sleep | 1.06 | 0.320 | 1.06 | 0.320 | 1.33 | 0.2584 | 0.3122 | 0.3166 | 0.31 | ||
| Age*Sleep | 0.04 | 0.848 | 0.01 | 0.970 | 0.02 | 0.8844 | 0.8932 | 0.8570 | 0.06 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 1.19 | 11.93 | 0.81 | 0.4332 | 0.30 | 0.66 | 0.4456 | 0.30 |
| Sleep on Old | 1.74 | 7.90 | 0.72 | 0.4950 | 0.30 | 0.51 | 0.4794 | 0.30 |
| Age on Control | 0.74 | 7.45 | 0.31 | 0.7638 | 0.13 | 0.10 | 0.7900 | 0.12 |
| Age on SR | 1.30 | 11.68 | 0.84 | 0.4160 | 0.19 | 0.71 | 0.4256 | 0.18 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 1.19 | 11.93 | 0.81 | 0.4332 | 0.30 | 0.66 | 0.4111 | 0.30 |
| Sleep on Old | 1.74 | 7.90 | 0.72 | 0.4950 | 0.30 | 0.51 | 0.5011 | 0.27 |
| Age on Control | 0.74 | 7.45 | 0.31 | 0.7638 | 0.14 | 0.10 | 0.7709 | 0.14 |
| Age on SR | 1.30 | 11.68 | 0.84 | 0.4160 | 0.17 | 0.71 | 0.4311 | 0.19 |
| YSR vs OC | -0.44 | 7.13 | -0.19 | 0.8560 | 0.11 | 0.04 | 0.8744 | 0.12 |
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.6561
2: B.p.value 0.5977
3: AB.p.value 0.3105
[1] "Taking bootstrap samples. Please wait."
Eff p.V1 p.Sig
1: A.p.value 0.6213
2: B.p.value 0.5987
3: AB.p.value 0.1640
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Adjusted p-values can be computed with the R function p.adjust"
$AOV
Names Q p Q.RMul p.RMul F.Rk1 p.Rk1 pBoot Sig pBootMas SigMas
1: Age 0.26 0.620 0.26 0.620 0.35 0.5611 0.6561 0.6213
2: Sleep 0.30 0.594 0.30 0.594 0.49 0.4921 0.5977 0.5987
3: Age*Sleep 2.25 0.158 -0.33 0.100 2.37 0.1355 0.3105 0.1640
EffSize
1: 0.18
2: 0.20
3: 0.60
$Detall
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 10.15 7.24 1.73 0.1256 0.66 3.00 0.1444
2: Sleep on Old -4.71 6.45 -0.59 0.5757 0.31 0.35 0.6222
3: Age on Control 4.91 5.59 0.64 0.5483 0.31 0.41 0.6033
4: Age on SR -9.96 8.94 -1.59 0.1469 0.55 2.52 0.1478
EffSize.Boot
1: 0.66
2: 0.31
3: 0.33
4: 0.57
$DetallExt
Contr psihat df test p.value EfSize.V1 Test.Boot p.Boot
1: Sleep on Young 10.15 7.24 1.73 0.1256 0.66 3.00 0.1144
2: Sleep on Old -4.71 6.45 -0.59 0.5757 0.31 0.35 0.6278
3: Age on Control 4.91 5.59 0.64 0.5483 0.31 0.41 0.5722
4: Age on SR -9.96 8.94 -1.59 0.1469 0.57 2.52 0.1567
5: YSR vs OC -5.24 9.64 -0.56 0.5868 0.18 0.32 0.6022
EffSize.Boot
1: 0.66
2: 0.31
3: 0.33
4: 0.59
5: 0.21
| Names | Q | p | Q.RMul | p.RMul | F.Rk1 | p.Rk1 | pBoot | Sig | pBootMas | SigMas | EffSize |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0.26 | 0.620 | 0.26 | 0.620 | 0.35 | 0.5611 | 0.6561 | 0.6213 | 0.18 | ||
| Sleep | 0.30 | 0.594 | 0.30 | 0.594 | 0.49 | 0.4921 | 0.5977 | 0.5987 | 0.20 | ||
| Age*Sleep | 2.25 | 0.158 | -0.33 | 0.100 | 2.37 | 0.1355 | 0.3105 | 0.1640 | 0.60 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 10.15 | 7.24 | 1.73 | 0.1256 | 0.66 | 3.00 | 0.1444 | 0.66 |
| Sleep on Old | -4.71 | 6.45 | -0.59 | 0.5757 | 0.31 | 0.35 | 0.6222 | 0.31 |
| Age on Control | 4.91 | 5.59 | 0.64 | 0.5483 | 0.31 | 0.41 | 0.6033 | 0.33 |
| Age on SR | -9.96 | 8.94 | -1.59 | 0.1469 | 0.55 | 2.52 | 0.1478 | 0.57 |
| Contr | psihat | df | test | p.value | EfSize.V1 | Test.Boot | p.Boot | EffSize.Boot |
|---|---|---|---|---|---|---|---|---|
| Sleep on Young | 10.15 | 7.24 | 1.73 | 0.1256 | 0.66 | 3.00 | 0.1144 | 0.66 |
| Sleep on Old | -4.71 | 6.45 | -0.59 | 0.5757 | 0.31 | 0.35 | 0.6278 | 0.31 |
| Age on Control | 4.91 | 5.59 | 0.64 | 0.5483 | 0.31 | 0.41 | 0.5722 | 0.33 |
| Age on SR | -9.96 | 8.94 | -1.59 | 0.1469 | 0.57 | 2.52 | 0.1567 | 0.59 |
| YSR vs OC | -5.24 | 9.64 | -0.56 | 0.5868 | 0.18 | 0.32 | 0.6022 | 0.21 |
quartz_off_screen
2